Revert "test(elements): only declare helpers if needed (#36114)"

This reverts commit 7e56222afbede515b0d5bcd8a74cd57db13dd9ad
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:06:29 -07:00
parent cf4883240b
commit c8f0c3b637

View File

@ -110,30 +110,32 @@ if (browserDetection.supportsCustomElements) {
expect(strategy.inputs.get('fooFoo')).toBe('foo-foo-value'); expect(strategy.inputs.get('fooFoo')).toBe('foo-foo-value');
expect(strategy.inputs.get('barBar')).toBe('barBar-value'); expect(strategy.inputs.get('barBar')).toBe('barBar-value');
}); });
});
}
// Helpers // Helpers
@Component({ @Component({
selector: 'test-component', selector: 'test-component',
template: 'TestComponent|foo({{ fooFoo }})|bar({{ barBar }})', template: 'TestComponent|foo({{ fooFoo }})|bar({{ barBar }})',
}) })
class TestComponent { class TestComponent {
@Input() fooFoo: string = 'foo'; @Input() fooFoo: string = 'foo';
// TODO(issue/24571): remove '!'. // TODO(issue/24571): remove '!'.
@Input('barbar') barBar!: string; @Input('barbar') barBar!: string;
@Output() bazBaz = new EventEmitter<boolean>(); @Output() bazBaz = new EventEmitter<boolean>();
@Output('quxqux') quxQux = new EventEmitter<Object>(); @Output('quxqux') quxQux = new EventEmitter<Object>();
} }
@NgModule({ @NgModule({
imports: [BrowserModule], imports: [BrowserModule],
declarations: [TestComponent], declarations: [TestComponent],
entryComponents: [TestComponent], entryComponents: [TestComponent],
}) })
class TestModule implements DoBootstrap { class TestModule implements DoBootstrap {
ngDoBootstrap() {} ngDoBootstrap() {}
} }
class TestStrategy implements NgElementStrategy { export class TestStrategy implements NgElementStrategy {
connectedElement: HTMLElement|null = null; connectedElement: HTMLElement|null = null;
disconnectCalled = false; disconnectCalled = false;
inputs = new Map<string, any>(); inputs = new Map<string, any>();
@ -155,14 +157,12 @@ if (browserDetection.supportsCustomElements) {
setInputValue(propName: string, value: string): void { setInputValue(propName: string, value: string): void {
this.inputs.set(propName, value); this.inputs.set(propName, value);
} }
} }
class TestStrategyFactory implements NgElementStrategyFactory { export class TestStrategyFactory implements NgElementStrategyFactory {
testStrategy = new TestStrategy(); testStrategy = new TestStrategy();
create(): NgElementStrategy { create(): NgElementStrategy {
return this.testStrategy; return this.testStrategy;
} }
}
});
} }