forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...er-cli/test/compliance/test_cases/r3_view_compiler_control_flow/switch_with_multi_case.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
template: ` | ||
<div> | ||
{{message}} | ||
@switch (value()) { | ||
@case (0; 1; 2) { | ||
case 0, 1, or 2 | ||
} | ||
@case (3) { | ||
case 3 | ||
} | ||
@case (4) { | ||
case 4 | ||
} | ||
} | ||
</div> | ||
`, | ||
standalone: false | ||
}) | ||
export class MyApp { | ||
message = 'hello'; | ||
value = () => 1; | ||
} |
33 changes: 33 additions & 0 deletions
33
...st/compliance/test_cases/r3_view_compiler_control_flow/switch_with_multi_case_template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function MyApp_Case_2_Template(rf, ctx) { | ||
if (rf & 1) { | ||
$r3$.ɵɵtext(0, " case 0, 1, or 2 "); | ||
} | ||
} | ||
|
||
function MyApp_Case_3_Template(rf, ctx) { | ||
if (rf & 1) { | ||
$r3$.ɵɵtext(0, " case 3 "); | ||
} | ||
} | ||
|
||
function MyApp_Case_4_Template(rf, ctx) { | ||
if (rf & 1) { | ||
$r3$.ɵɵtext(0, " case 4 "); | ||
} | ||
} | ||
… | ||
function MyApp_Template(rf, ctx) { | ||
if (rf & 1) { | ||
$r3$.ɵɵelementStart(0, "div"); | ||
$r3$.ɵɵtext(1); | ||
$r3$.ɵɵtemplate(2, MyApp_Case_2_Template, 1, 0)(3, MyApp_Case_3_Template, 1, 0)(4, MyApp_Case_4_Template, 1, 0); | ||
$r3$.ɵɵelementEnd(); | ||
} | ||
if (rf & 2) { | ||
let $MyApp_contFlowTmp$; | ||
$r3$.ɵɵadvance(); | ||
$r3$.ɵɵtextInterpolate1(" ", ctx.message, " "); | ||
$r3$.ɵɵadvance(); | ||
$r3$.ɵɵconditional(($MyApp_contFlowTmp$ = ctx.value()) === 0 ? 2 : $MyApp_contFlowTmp$ === 1 ? 3 : $MyApp_contFlowTmp$ === 2 ? 4 : -1); | ||
} | ||
} |