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.
refactor(compiler): Add a new test for bindings on
ng-template
elem…
…ents. Consider the following very strange template: ``` <ng-template l="l1" [p]="p1" [attr.a]="a1" [class.c]="c1"></ng-template> ``` It's not clear what a class binding on an `ng-template` would actually do. Nonetheless, it's well-defined behavior in TemplateDefinitionBuilder, which emits `property` instructions for all three bindings, and people rely actually do this in google3. The test isn't passing yet, so check it in disabled for template pipeline.
- Loading branch information
Showing
3 changed files
with
36 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
12 changes: 12 additions & 0 deletions
12
...compiler-cli/test/compliance/test_cases/r3_view_compiler_template/ng_template_bindings.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,12 @@ | ||
function MyComponent_ng_template_0_Template(rf, ctx) { } | ||
|
||
… | ||
|
||
consts: [["l", "l1", __AttributeMarker.Bindings__, "p", "c"]], | ||
template: function MyComponent_Template(rf, ctx) { | ||
if (rf & 1) { | ||
i0.ɵɵtemplate(0, MyComponent_ng_template_0_Template, 0, 0, "ng-template", 0); | ||
} if (rf & 2) { | ||
i0.ɵɵproperty("p", ctx.p1)("a", ctx.a1)("c", ctx.c1); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...compiler-cli/test/compliance/test_cases/r3_view_compiler_template/ng_template_bindings.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,12 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'my-component', | ||
standalone: true, | ||
template: '<ng-template l="l1" [p]="p1" [attr.a]="a1" [class.c]="c1"></ng-template>', | ||
}) | ||
export class MyComponent { | ||
p1!: any; | ||
a1!: any; | ||
c1!: any; | ||
} |