angular-cn/packages/compiler-cli/test/compliance
Pete Bacon Darwin f535f31d78 fix(ivy): match attribute selectors for content projection with inline-templates (#29041)
The content projection mechanism is static, in that it only looks at the static
template nodes before directives are matched and change detection is run.
When you have a selector-based content projection the selection is based
on nodes that are available in the template.

For example:

```
<ng-content selector="[some-attr]"></ng-content>
```

would match

```
<div some-attr="..."></div>
```

If you have an inline-template in your projected nodes. For example:

```
<div *ngIf="..." some-attr="..."></div>
```

This gets pre-parsed and converted to a canonical form.

For example:

```
<ng-template [ngIf]="...">
  <div some-attr=".."></div>
</ng-template>
```

Note that only structural attributes (e.g. `*ngIf`) stay with the `<ng-template>`
node. The other attributes move to the contained element inside the template.

When this happens in ivy, the ng-template content is removed
from the component template function and is compiled into its own
template function. But this means that the information about the
attributes that were on the content are lost and the projection
selection mechanism is unable to match the original
`<div *ngIf="..." some-attr>`.

This commit adds support for this in ivy. Attributes are separated into three
groups (Bindings, Templates and "other"). For inline-templates the Bindings
and "other" types are hoisted back from the contained node to the `template()`
instruction, so that they can be used in content projection matching.

PR Close #29041
2019-03-07 11:27:36 -08:00
..
BUILD.bazel build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871) 2019-02-28 12:06:36 -08:00
README.md build: use bazel version from node modules (#26691) 2018-10-30 16:19:13 -04:00
mock_compile.ts test(ivy): compiler compliance tests should support ? (#25435) 2018-08-10 17:12:18 -07:00
mock_compiler_spec.ts refactor(ivy): remove short instruction names as they provide no value (#25493) 2018-08-16 11:04:34 -07:00
r3_compiler_compliance_spec.ts fix(ivy): match attribute selectors for content projection with inline-templates (#29041) 2019-03-07 11:27:36 -08:00
r3_view_compiler_binding_spec.ts refactor: rename `AttributeMarker.ProjectOnly` to `AttributeMarker.Bindings` (#29041) 2019-03-07 11:27:35 -08:00
r3_view_compiler_di_spec.ts feat(ivy): enable inheritance of factory functions in definitions (#25392) 2018-08-09 09:58:13 -07:00
r3_view_compiler_directives_spec.ts fix(ivy): match attribute selectors for content projection with inline-templates (#29041) 2019-03-07 11:27:36 -08:00
r3_view_compiler_i18n_spec.ts fix(ivy): match attribute selectors for content projection with inline-templates (#29041) 2019-03-07 11:27:36 -08:00
r3_view_compiler_input_outputs_spec.ts fix(compiler): generate inputs with aliases properly (#26774) 2018-10-26 17:23:45 -04:00
r3_view_compiler_listener_spec.ts fix(ivy): match attribute selectors for content projection with inline-templates (#29041) 2019-03-07 11:27:36 -08:00
r3_view_compiler_providers_spec.ts feat(ivy): support providers and viewProviders (#25803) 2018-10-25 12:58:40 -04:00
r3_view_compiler_spec.ts fix(ivy): ensure animation @trigger ordering is correctly delivered to the renderer (#28165) 2019-01-17 09:58:29 -08:00
r3_view_compiler_styling_spec.ts refactor: rename `AttributeMarker.ProjectOnly` to `AttributeMarker.Bindings` (#29041) 2019-03-07 11:27:35 -08:00
r3_view_compiler_template_spec.ts fix(ivy): match attribute selectors for content projection with inline-templates (#29041) 2019-03-07 11:27:36 -08:00

README.md

Tests in this directory should be run with:

yarn bazel test --define=compile=aot  packages/compiler-cli/test/compliance:compliance