angular-docs-cn/packages/elements/test
George Kalpakas 89b44d1900 fix(elements): do not break when the constructor of an Angular Element is not called (#36114)
Previously, the correct behavior of Angular custom elements relied on
the constructor being called (and thus the `injector` property being
initialized). However, some polyfills (e.g. `document-register-element`)
do not call the constructor of custom elements, which resulted in the
`injector` property being undefined and the `NgElementStrategy` failing
to be instantiated.

This commit fixes it by being tolerant to the `injector` property being
undefined and falling back to the injector passed to the
`createCustomElement()` config.

NOTE:
We don't have proper tests exercising the situation where the
constructor is not called. For now this is tested using a Google
internal test suite (which is how this issue was caught).
This commit also adds a rudimentary unit test to emulate this situation.

PR Close #36114
2020-05-20 09:43:36 -07:00
..
BUILD.bazel build: fix and re-enable elements tests on saucelabs (#36929) 2020-05-05 12:04:48 -07:00
component-factory-strategy_spec.ts build: reformat repo to new clang@1.4.0 (#36613) 2020-04-14 12:08:36 -07:00
create-custom-element_spec.ts fix(elements): do not break when the constructor of an Angular Element is not called (#36114) 2020-05-20 09:43:36 -07:00
extract-projectable-nodes_spec.ts refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
slots_spec.ts build: reformat repo to new clang@1.4.0 (#36613) 2020-04-14 12:08:36 -07:00
utils_spec.ts fix(zone.js): add issue numbers of `@types/jasmine` to the test cases (#34625) 2020-04-08 12:10:34 -07:00