angular-cn/packages/core/test/acceptance
Kristiyan Kostadinov 104546569e fix(compiler): incorrectly interpreting some HostBinding names (#40233)
Currently when analyzing the metadata of a directive, we bundle together the bindings from `host`
and the `HostBinding` and `HostListener` together. This can become a problem later on in the
compilation pipeline, because we try to evaluate the value of the binding, causing something like
`@HostBinding('class.foo') public true = 1;` to be treated the same as
`host: {'[class.foo]': 'true'}`.

While looking into the issue, I noticed another one that is closely related: we weren't treating
quoted property names correctly. E.g. `@HostBinding('class.foo') public "foo-bar" = 1;` was being
interpreted as `classProp('foo', ctx.foo - ctx.bar)` due to the same issue where property names
were being evaluated.

These changes resolve both of the issues by treating all `HostBinding` instance as if they're
reading the property from `this`. E.g. the `@HostBinding('class.foo') public true = 1;` from above
is now being treated as `host: {'[class.foo]': 'this.true'}` which further down the pipeline becomes
`classProp('foo', ctx.true)`. This doesn't have any payload size implications for existing code,
because we've always been prefixing implicit property reads with `ctx.`. If the property doesn't
have an identifier that can be read using dotted access, we convert it to a quoted one (e.g.
`classProp('foo', ctx['is-foo']))`.

Fixes #40220.
Fixes #40230.
Fixes #18698.

PR Close #40233
2021-01-07 13:15:46 -08:00
..
BUILD.bazel refactor(core): add debug ranges to `LViewDebug` with matchers (#38359) 2020-08-06 16:58:11 -07:00
attributes_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
bootstrap_spec.ts fix(core): unsubscribe from the `onError` when the root view is removed (#39940) 2020-12-03 13:44:17 -08:00
change_detection_spec.ts fix(core): Ensure OnPush ancestors are marked dirty when events occur (#39833) 2020-11-25 14:39:19 -08:00
change_detection_transplanted_view_spec.ts fix(core): clear the `RefreshTransplantedView` when detached (#38768) 2020-09-10 09:11:38 -07:00
common_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_spec.ts fix(core): Call `onDestroy` in production mode as well (#40120) 2020-12-22 08:02:27 -08:00
content_spec.ts docs: update links to use HTTPS as protocol (#39718) 2020-11-20 12:52:16 -08:00
copy_definition_feature_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
debug_spec.ts refactor(core): Create `TNodeType.Text` to display full template in `TView` debug (#39233) 2020-10-21 18:33:00 -07:00
di_spec.ts fix(core): take @Host into account while processing `useFactory` arguments (#40122) 2021-01-05 10:14:25 -08:00
directive_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
discover_utils_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
embedded_views_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
exports_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
host_binding_spec.ts fix(compiler): incorrectly interpreting some HostBinding names (#40233) 2021-01-07 13:15:46 -08:00
i18n_spec.ts fix(compiler): avoid duplicate i18n blocks for i18n attrs on elements with structural directives (#40077) 2020-12-15 13:40:09 -08:00
inherit_definition_feature_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
integration_spec.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
lifecycle_spec.ts fix(core): error if detectChanges is called at the wrong time under specific circumstances (#40206) 2020-12-22 14:52:12 -08:00
listener_spec.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
ng_module_spec.ts fix(core): incorrectly validating properties on ng-content and ng-container (#37773) 2020-07-15 12:39:39 -07:00
ngdevmode_debug_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ngmodule_scope_spec.ts fix(core): prevent NgModule scope being overwritten in JIT compiler (#37795) 2020-08-11 09:50:27 -07:00
outputs_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_spec.ts fix(compiler): evaluate safe navigation expressions in correct binding order (#37911) 2020-08-11 09:51:10 -07:00
property_binding_spec.ts fix(compiler): don't report parse error for interpolation inside string in property binding (#40267) 2021-01-05 13:57:23 -08:00
property_interpolation_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
providers_spec.ts feat(core): update reference and doc to change `async` to `waitAsync`. (#37583) 2020-08-03 12:54:13 -07:00
pure_function_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
query_spec.ts fix(core): queries not matching string injection tokens (#38321) 2020-08-10 15:27:24 -07:00
renderer_factory_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
router_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
security_spec.ts fix(core): fix possible XSS attack in development through SSR. (#40136) 2020-12-16 09:38:08 -08:00
styling_spec.ts fix(core): handle !important in style property value (#39603) 2020-11-12 09:11:18 -08:00
template_ref_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
text_spec.ts fix(compiler): handle strings inside bindings that contain binding characters (#39826) 2020-12-10 11:11:21 -08:00
view_container_ref_spec.ts fix(core): fix multiple nested views removal from ViewContainerRef (#38317) 2020-08-13 13:35:53 -07:00
view_insertion_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
view_ref_spec.ts fix(core): error when invoking callbacks registered via ViewRef.onDestroy (#37543) 2020-06-26 15:02:41 -07:00