Revert "fix(elements): do not break when the constructor of an Angular Element is not called (#36114)"

This reverts commit 87b9f08d3b
because it is causing the side effects test to break on the
9.1.x branch.
This commit is contained in:
Kara Erickson
2020-05-20 11:04:55 -07:00
parent 94fc8463cc
commit 12d8af50dd
2 changed files with 7 additions and 33 deletions

View File

@ -73,26 +73,6 @@ if (browserDetection.supportsCustomElements) {
expect(strategy.getInputValue('barBar')).toBe('value-barbar');
});
it('should work even if when the constructor is not called (due to polyfill)', () => {
// Some polyfills (e.g. `document-register-element`) do not call the constructor of custom
// elements. Currently, all the constructor does is initialize the `injector` property. This
// test simulates not having called the constructor by "unsetting" the property.
//
// NOTE:
// If the constructor implementation changes in the future, this test needs to be adjusted
// accordingly.
const element = new NgElementCtor(injector);
delete (element as any).injector;
element.setAttribute('foo-foo', 'value-foo-foo');
element.setAttribute('barbar', 'value-barbar');
element.connectedCallback();
expect(strategy.connectedElement).toBe(element);
expect(strategy.getInputValue('fooFoo')).toBe('value-foo-foo');
expect(strategy.getInputValue('barBar')).toBe('value-barbar');
});
it('should listen to output events after connected', () => {
const element = new NgElementCtor(injector);
element.connectedCallback();
@ -280,14 +260,7 @@ if (browserDetection.supportsCustomElements) {
class TestStrategyFactory implements NgElementStrategyFactory {
testStrategy = new TestStrategy();
create(injector: Injector): NgElementStrategy {
// Although not used by the `TestStrategy`, verify that the injector is provided.
if (!injector) {
throw new Error(
'Expected injector to be passed to `TestStrategyFactory#create()`, but received ' +
`value of type ${typeof injector}: ${injector}`);
}
create(): NgElementStrategy {
return this.testStrategy;
}
}