From c8f0c3b637bf8aee9d366f421f12cccd5dfa2848 Mon Sep 17 00:00:00 2001 From: Kara Erickson Date: Wed, 20 May 2020 11:06:29 -0700 Subject: [PATCH] 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. --- .../test/create-custom-element_spec.ts | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/packages/elements/test/create-custom-element_spec.ts b/packages/elements/test/create-custom-element_spec.ts index 0f22c9a2f2..913a5aa1ff 100644 --- a/packages/elements/test/create-custom-element_spec.ts +++ b/packages/elements/test/create-custom-element_spec.ts @@ -110,59 +110,59 @@ if (browserDetection.supportsCustomElements) { expect(strategy.inputs.get('fooFoo')).toBe('foo-foo-value'); expect(strategy.inputs.get('barBar')).toBe('barBar-value'); }); - - // Helpers - @Component({ - selector: 'test-component', - template: 'TestComponent|foo({{ fooFoo }})|bar({{ barBar }})', - }) - class TestComponent { - @Input() fooFoo: string = 'foo'; - // TODO(issue/24571): remove '!'. - @Input('barbar') barBar!: string; - - @Output() bazBaz = new EventEmitter(); - @Output('quxqux') quxQux = new EventEmitter(); - } - @NgModule({ - imports: [BrowserModule], - declarations: [TestComponent], - entryComponents: [TestComponent], - }) - class TestModule implements DoBootstrap { - ngDoBootstrap() {} - } - - class TestStrategy implements NgElementStrategy { - connectedElement: HTMLElement|null = null; - disconnectCalled = false; - inputs = new Map(); - - events = new Subject(); - - connect(element: HTMLElement): void { - this.connectedElement = element; - } - - disconnect(): void { - this.disconnectCalled = true; - } - - getInputValue(propName: string): any { - return this.inputs.get(propName); - } - - setInputValue(propName: string, value: string): void { - this.inputs.set(propName, value); - } - } - - class TestStrategyFactory implements NgElementStrategyFactory { - testStrategy = new TestStrategy(); - - create(): NgElementStrategy { - return this.testStrategy; - } - } }); } + +// Helpers +@Component({ + selector: 'test-component', + template: 'TestComponent|foo({{ fooFoo }})|bar({{ barBar }})', +}) +class TestComponent { + @Input() fooFoo: string = 'foo'; + // TODO(issue/24571): remove '!'. + @Input('barbar') barBar!: string; + + @Output() bazBaz = new EventEmitter(); + @Output('quxqux') quxQux = new EventEmitter(); +} +@NgModule({ + imports: [BrowserModule], + declarations: [TestComponent], + entryComponents: [TestComponent], +}) +class TestModule implements DoBootstrap { + ngDoBootstrap() {} +} + +export class TestStrategy implements NgElementStrategy { + connectedElement: HTMLElement|null = null; + disconnectCalled = false; + inputs = new Map(); + + events = new Subject(); + + connect(element: HTMLElement): void { + this.connectedElement = element; + } + + disconnect(): void { + this.disconnectCalled = true; + } + + getInputValue(propName: string): any { + return this.inputs.get(propName); + } + + setInputValue(propName: string, value: string): void { + this.inputs.set(propName, value); + } +} + +export class TestStrategyFactory implements NgElementStrategyFactory { + testStrategy = new TestStrategy(); + + create(): NgElementStrategy { + return this.testStrategy; + } +}