From 9d54679e6628bdcda93e543fcc87037da5583a85 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Sat, 5 Oct 2019 10:04:54 +0200 Subject: [PATCH] test: clean up explicit dynamic query usages (#33015) Cleans up all the places where we explicitly set `static: false` on queries. PR Close #33015 --- .../binding-syntax/src/app/app.component.ts | 2 +- .../src/app/countdown-parent.component.ts | 2 +- .../src/app/after-content.component.ts | 2 +- .../src/app/after-view.component.ts | 2 +- .../src/app/do-check.component.ts | 2 +- .../src/app/on-changes.component.ts | 2 +- .../src/app/app.component.ts | 2 +- .../src/app/hero-form.component.ts | 2 +- .../src/app/shared/canvas.component.ts | 2 +- .../dynamic-compiler/src/app.component.ts | 2 +- .../expanding_rows/expanding_row_summary.ts | 2 +- .../compliance/r3_compiler_compliance_spec.ts | 14 +-- .../compiler-cli/test/ngtsc/ngtsc_spec.ts | 18 ++-- packages/compiler/test/core_spec.ts | 14 ++- .../compiler/test/directive_resolver_spec.ts | 34 +++---- ...ated_classes_with_decorated_fields_spec.ts | 4 +- ...es_with_decorated_fields_migration_spec.ts | 4 +- .../test/acceptance/change_detection_spec.ts | 34 +++---- .../core/test/acceptance/component_spec.ts | 2 +- packages/core/test/acceptance/di_spec.ts | 94 +++++++++---------- .../test/acceptance/discover_utils_spec.ts | 6 +- .../core/test/acceptance/host_binding_spec.ts | 32 +++---- .../core/test/acceptance/integration_spec.ts | 30 +++--- .../core/test/acceptance/lifecycle_spec.ts | 2 +- .../core/test/acceptance/listener_spec.ts | 2 +- packages/core/test/acceptance/outputs_spec.ts | 24 ++--- packages/core/test/acceptance/pipe_spec.ts | 6 +- packages/core/test/acceptance/query_spec.ts | 54 +++++------ packages/core/test/acceptance/styling_spec.ts | 6 +- .../core/test/acceptance/template_ref_spec.ts | 2 +- .../acceptance/view_container_ref_spec.ts | 4 +- .../test/acceptance/view_insertion_spec.ts | 12 +-- .../animation/animation_integration_spec.ts | 24 ++--- .../animation_query_integration_spec.ts | 40 ++++---- ...s_keyframes_animations_integration_spec.ts | 4 +- packages/core/test/application_ref_spec.ts | 2 +- packages/core/test/debug/debug_node_spec.ts | 2 +- .../test/linker/query_integration_spec.ts | 32 +++---- packages/core/test/metadata/di_spec.ts | 4 +- packages/core/test/render3/ivy/jit_spec.ts | 6 +- .../ts/contentChild/content_child_example.ts | 2 +- .../di/ts/contentChild/content_child_howto.ts | 2 +- .../di/ts/viewChild/view_child_example.ts | 2 +- .../core/di/ts/viewChild/view_child_howto.ts | 2 +- .../test/animation_renderer_spec.ts | 8 +- .../test/browser_animation_builder_spec.ts | 2 +- 46 files changed, 273 insertions(+), 279 deletions(-) diff --git a/aio/content/examples/binding-syntax/src/app/app.component.ts b/aio/content/examples/binding-syntax/src/app/app.component.ts index 3349acbd47..bed9bd2a75 100644 --- a/aio/content/examples/binding-syntax/src/app/app.component.ts +++ b/aio/content/examples/binding-syntax/src/app/app.component.ts @@ -8,7 +8,7 @@ import { Component, ViewChild, ElementRef } from '@angular/core'; }) export class AppComponent { - @ViewChild('bindingInput', { static: false }) bindingInput: ElementRef; + @ViewChild('bindingInput') bindingInput: ElementRef; isUnchanged = true; diff --git a/aio/content/examples/component-interaction/src/app/countdown-parent.component.ts b/aio/content/examples/component-interaction/src/app/countdown-parent.component.ts index 57f7230d89..9f4e5bd4df 100644 --- a/aio/content/examples/component-interaction/src/app/countdown-parent.component.ts +++ b/aio/content/examples/component-interaction/src/app/countdown-parent.component.ts @@ -39,7 +39,7 @@ export class CountdownLocalVarParentComponent { } }) export class CountdownViewChildParentComponent implements AfterViewInit { - @ViewChild(CountdownTimerComponent, {static: false}) + @ViewChild(CountdownTimerComponent) private timerComponent: CountdownTimerComponent; seconds() { return 0; } diff --git a/aio/content/examples/lifecycle-hooks/src/app/after-content.component.ts b/aio/content/examples/lifecycle-hooks/src/app/after-content.component.ts index 858ea12c59..36d2cff20f 100644 --- a/aio/content/examples/lifecycle-hooks/src/app/after-content.component.ts +++ b/aio/content/examples/lifecycle-hooks/src/app/after-content.component.ts @@ -34,7 +34,7 @@ export class AfterContentComponent implements AfterContentChecked, AfterContentI comment = ''; // Query for a CONTENT child of type `ChildComponent` - @ContentChild(ChildComponent, {static: false}) contentChild: ChildComponent; + @ContentChild(ChildComponent) contentChild: ChildComponent; // #enddocregion hooks constructor(private logger: LoggerService) { diff --git a/aio/content/examples/lifecycle-hooks/src/app/after-view.component.ts b/aio/content/examples/lifecycle-hooks/src/app/after-view.component.ts index 59c472b37a..fd09962406 100644 --- a/aio/content/examples/lifecycle-hooks/src/app/after-view.component.ts +++ b/aio/content/examples/lifecycle-hooks/src/app/after-view.component.ts @@ -35,7 +35,7 @@ export class AfterViewComponent implements AfterViewChecked, AfterViewInit { private prevHero = ''; // Query for a VIEW child of type `ChildViewComponent` - @ViewChild(ChildViewComponent, {static: false}) viewChild: ChildViewComponent; + @ViewChild(ChildViewComponent) viewChild: ChildViewComponent; // #enddocregion hooks constructor(private logger: LoggerService) { diff --git a/aio/content/examples/lifecycle-hooks/src/app/do-check.component.ts b/aio/content/examples/lifecycle-hooks/src/app/do-check.component.ts index 098ee941d2..4b8a088b9a 100644 --- a/aio/content/examples/lifecycle-hooks/src/app/do-check.component.ts +++ b/aio/content/examples/lifecycle-hooks/src/app/do-check.component.ts @@ -81,7 +81,7 @@ export class DoCheckParentComponent { hero: Hero; power: string; title = 'DoCheck'; - @ViewChild(DoCheckComponent, {static: false}) childView: DoCheckComponent; + @ViewChild(DoCheckComponent) childView: DoCheckComponent; constructor() { this.reset(); } diff --git a/aio/content/examples/lifecycle-hooks/src/app/on-changes.component.ts b/aio/content/examples/lifecycle-hooks/src/app/on-changes.component.ts index 09f3169cc2..7b9cda05ef 100644 --- a/aio/content/examples/lifecycle-hooks/src/app/on-changes.component.ts +++ b/aio/content/examples/lifecycle-hooks/src/app/on-changes.component.ts @@ -55,7 +55,7 @@ export class OnChangesParentComponent { hero: Hero; power: string; title = 'OnChanges'; - @ViewChild(OnChangesComponent, {static: false}) childView: OnChangesComponent; + @ViewChild(OnChangesComponent) childView: OnChangesComponent; constructor() { this.reset(); diff --git a/aio/content/examples/template-reference-variables/src/app/app.component.ts b/aio/content/examples/template-reference-variables/src/app/app.component.ts index a3546121df..706ccea85f 100644 --- a/aio/content/examples/template-reference-variables/src/app/app.component.ts +++ b/aio/content/examples/template-reference-variables/src/app/app.component.ts @@ -8,7 +8,7 @@ import { NgForm } from '@angular/forms'; styleUrls: ['./app.component.css'] }) export class AppComponent { - @ViewChild('itemForm', { static: false }) form: NgForm; + @ViewChild('itemForm') form: NgForm; private _submitMessage = ''; diff --git a/aio/content/examples/template-syntax/src/app/hero-form.component.ts b/aio/content/examples/template-syntax/src/app/hero-form.component.ts index 2b1a48666f..0c52e73f55 100644 --- a/aio/content/examples/template-syntax/src/app/hero-form.component.ts +++ b/aio/content/examples/template-syntax/src/app/hero-form.component.ts @@ -13,7 +13,7 @@ import { Hero } from './hero'; }) export class HeroFormComponent { @Input() hero: Hero; - @ViewChild('heroForm', {static: false}) form: NgForm; + @ViewChild('heroForm') form: NgForm; // tslint:disable-next-line:variable-name private _submitMessage = ''; diff --git a/aio/content/examples/testing/src/app/shared/canvas.component.ts b/aio/content/examples/testing/src/app/shared/canvas.component.ts index 5d57b0992b..251ee01d96 100644 --- a/aio/content/examples/testing/src/app/shared/canvas.component.ts +++ b/aio/content/examples/testing/src/app/shared/canvas.component.ts @@ -6,7 +6,7 @@ import { Component, AfterViewInit, ViewChild, ElementRef } from '@angular/core'; }) export class CanvasComponent implements AfterViewInit { blobSize: number; - @ViewChild('sampleCanvas', {static: false}) sampleCanvas: ElementRef; + @ViewChild('sampleCanvas') sampleCanvas: ElementRef; constructor() { } diff --git a/integration/dynamic-compiler/src/app.component.ts b/integration/dynamic-compiler/src/app.component.ts index 16ec786eb7..d593dca12e 100644 --- a/integration/dynamic-compiler/src/app.component.ts +++ b/integration/dynamic-compiler/src/app.component.ts @@ -10,7 +10,7 @@ declare var System: any; `, }) export class AppComponent implements AfterViewInit { - @ViewChild('vc', {read: ViewContainerRef, static: false}) container: ViewContainerRef; + @ViewChild('vc', {read: ViewContainerRef}) container: ViewContainerRef; constructor(private compiler: Compiler) {} diff --git a/modules/benchmarks/src/expanding_rows/expanding_row_summary.ts b/modules/benchmarks/src/expanding_rows/expanding_row_summary.ts index 172b97ee49..e8ffb31534 100644 --- a/modules/benchmarks/src/expanding_rows/expanding_row_summary.ts +++ b/modules/benchmarks/src/expanding_rows/expanding_row_summary.ts @@ -48,7 +48,7 @@ export class ExpandingRowSummary implements OnDestroy { * reference to compute collapsed height of the row. We also use this * reference for focus and blur methods below. */ - @ViewChild('expandingRowSummaryMainElement', {static: false}) + @ViewChild('expandingRowSummaryMainElement') mainElementRef !: ElementRef; /** Subscription for changes in parent isExpanded property. */ diff --git a/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts b/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts index 7d62d559ae..1bbc06126e 100644 --- a/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_compiler_compliance_spec.ts @@ -1622,7 +1622,7 @@ describe('compiler compliance', () => { }) export class ViewQueryComponent { @ViewChild(SomeDirective, {static: true}) someDir !: SomeDirective; - @ViewChild('foo', {static: false}) foo !: ElementRef; + @ViewChild('foo') foo !: ElementRef; } @NgModule({declarations: [SomeDirective, ViewQueryComponent]}) @@ -1740,7 +1740,7 @@ describe('compiler compliance', () => { \` }) export class ContentQueryComponent { - @ContentChild(SomeDirective, {static: false}) someDir: SomeDirective; + @ContentChild(SomeDirective) someDir: SomeDirective; @ContentChildren(SomeDirective) someDirList !: QueryList; } @@ -1809,7 +1809,7 @@ describe('compiler compliance', () => { \` }) export class ContentQueryComponent { - @ContentChild('myRef', {static: false}) myRef: any; + @ContentChild('myRef') myRef: any; @ContentChildren('myRef1, myRef2, myRef3') myRefs: QueryList; } @NgModule({declarations: [ContentQueryComponent]}) @@ -1860,7 +1860,7 @@ describe('compiler compliance', () => { }) export class ContentQueryComponent { @ContentChild(SomeDirective, {static: true}) someDir !: SomeDirective; - @ContentChild('foo', {static: false}) foo !: ElementRef; + @ContentChild('foo') foo !: ElementRef; } @Component({ @@ -1931,9 +1931,9 @@ describe('compiler compliance', () => { \` }) export class ContentQueryComponent { - @ContentChild('myRef', {read: TemplateRef, static: false}) myRef: TemplateRef; + @ContentChild('myRef', {read: TemplateRef}) myRef: TemplateRef; @ContentChildren('myRef1, myRef2, myRef3', {read: ElementRef}) myRefs: QueryList; - @ContentChild(SomeDirective, {read: ElementRef, static: false}) someDir: ElementRef; + @ContentChild(SomeDirective, {read: ElementRef}) someDir: ElementRef; @ContentChildren(SomeDirective, {read: TemplateRef}) someDirs: QueryList; } @NgModule({declarations: [ContentQueryComponent]}) @@ -3210,7 +3210,7 @@ describe('compiler compliance', () => { 'spec.ts': ` import {Component, NgModule, ContentChild} from '@angular/core'; export class BaseClass { - @ContentChild('something', {static: false}) something: any; + @ContentChild('something') something: any; } @Component({ diff --git a/packages/compiler-cli/test/ngtsc/ngtsc_spec.ts b/packages/compiler-cli/test/ngtsc/ngtsc_spec.ts index 98a7be5acd..321b44d78f 100644 --- a/packages/compiler-cli/test/ngtsc/ngtsc_spec.ts +++ b/packages/compiler-cli/test/ngtsc/ngtsc_spec.ts @@ -1094,7 +1094,7 @@ runInEachFileSystem(os => { template: '' }) export class TestCmp { - @Input() @ContentChild('foo', {static: false}) foo: any; + @Input() @ContentChild('foo') foo: any; } `); @@ -1116,7 +1116,7 @@ runInEachFileSystem(os => { }) export class TestCmp { @ContentChild('bar', {static: true}) - @ContentChild('foo', {static: false}) + @ContentChild('foo') foo: any; } `); @@ -1138,7 +1138,7 @@ runInEachFileSystem(os => { template: '...' }) export class TestCmp { - @ContentChild('foo', {static: false}) + @ContentChild('foo') private someFn() {} } `); @@ -1653,10 +1653,10 @@ runInEachFileSystem(os => { } }) class FooCmp { - @ContentChild('bar', {read: TemplateRef, static: false}) child: any; + @ContentChild('bar', {read: TemplateRef}) child: any; @ContentChildren(TemplateRef) children: any; get aview(): any { return null; } - @ViewChild('accessor', {static: false}) set aview(value: any) {} + @ViewChild('accessor') set aview(value: any) {} } `); @@ -1684,7 +1684,7 @@ runInEachFileSystem(os => { } }) class FooCmp { - @ContentChild('bar', {read: TemplateRef, static: false}) child: any; + @ContentChild('bar', {read: TemplateRef}) child: any; @ContentChildren(TemplateRef) children: any; get aview(): any { return null; } @ViewChild('accessor') set aview(value: any) {} @@ -1715,11 +1715,11 @@ runInEachFileSystem(os => { template: '
', }) class FooCmp { - @ContentChild(forwardRef(() => TemplateRef), {static: false}) child: any; + @ContentChild(forwardRef(() => TemplateRef)) child: any; - @ContentChild(forwardRef(function() { return ViewContainerRef; }), {static: false}) child2: any; + @ContentChild(forwardRef(function() { return ViewContainerRef; })) child2: any; - @ContentChild((forwardRef((function() { return 'parens'; }) as any)), {static: false}) childInParens: any; + @ContentChild((forwardRef((function() { return 'parens'; }) as any))) childInParens: any; } `); diff --git a/packages/compiler/test/core_spec.ts b/packages/compiler/test/core_spec.ts index c4acff371b..f5864584cc 100644 --- a/packages/compiler/test/core_spec.ts +++ b/packages/compiler/test/core_spec.ts @@ -27,11 +27,10 @@ import * as core from '@angular/core'; typeExtends(); typeExtends(); compareRuntimeShape( - new core.ContentChild('someSelector', {static: false}), - compilerCore.createContentChild('someSelector', {static: false})); + new core.ContentChild('someSelector'), compilerCore.createContentChild('someSelector')); compareRuntimeShape( - new core.ContentChild('someSelector', {read: 'someRead', static: false}), - compilerCore.createContentChild('someSelector', {read: 'someRead', static: false})); + new core.ContentChild('someSelector', {read: 'someRead'}), + compilerCore.createContentChild('someSelector', {read: 'someRead'})); compareRuntimeShape( new core.ContentChildren('someSelector'), compilerCore.createContentChildren('someSelector')); @@ -40,11 +39,10 @@ import * as core from '@angular/core'; compilerCore.createContentChildren( 'someSelector', {read: 'someRead', descendants: false})); compareRuntimeShape( - new core.ViewChild('someSelector', {static: false}), - compilerCore.createViewChild('someSelector', {static: false})); + new core.ViewChild('someSelector'), compilerCore.createViewChild('someSelector')); compareRuntimeShape( - new core.ViewChild('someSelector', {read: 'someRead', static: false}), - compilerCore.createViewChild('someSelector', {read: 'someRead', static: false})); + new core.ViewChild('someSelector', {read: 'someRead'}), + compilerCore.createViewChild('someSelector', {read: 'someRead'})); compareRuntimeShape( new core.ViewChildren('someSelector'), compilerCore.createViewChildren('someSelector')); compareRuntimeShape( diff --git a/packages/compiler/test/directive_resolver_spec.ts b/packages/compiler/test/directive_resolver_spec.ts index e0ad64bb9f..4d211643f9 100644 --- a/packages/compiler/test/directive_resolver_spec.ts +++ b/packages/compiler/test/directive_resolver_spec.ts @@ -68,15 +68,15 @@ class SomeDirectiveWithViewChildren { c: any; } -@Directive({selector: 'someDirective', queries: {'c': new ContentChild('c', {static: false})}}) +@Directive({selector: 'someDirective', queries: {'c': new ContentChild('c')}}) class SomeDirectiveWithContentChild { - @ContentChild('a', {static: false}) a: any; + @ContentChild('a') a: any; c: any; } -@Directive({selector: 'someDirective', queries: {'c': new ViewChild('c', {static: false})}}) +@Directive({selector: 'someDirective', queries: {'c': new ViewChild('c')}}) class SomeDirectiveWithViewChild { - @ViewChild('a', {static: false}) a: any; + @ViewChild('a') a: any; c: any; } @@ -408,41 +408,37 @@ class SomeDirectiveWithoutMetadata {} it('should append ContentChild', () => { const directiveMetadata = resolver.resolve(SomeDirectiveWithContentChild); - expect(directiveMetadata.queries).toEqual({ - 'c': new ContentChild('c', {static: false}), - 'a': new ContentChild('a', {static: false}) - }); + expect(directiveMetadata.queries) + .toEqual({'c': new ContentChild('c'), 'a': new ContentChild('a')}); }); it('should append ViewChild', () => { const directiveMetadata = resolver.resolve(SomeDirectiveWithViewChild); - expect(directiveMetadata.queries).toEqual({ - 'c': new ViewChild('c', {static: false}), - 'a': new ViewChild('a', {static: false}) - }); + expect(directiveMetadata.queries) + .toEqual({'c': new ViewChild('c'), 'a': new ViewChild('a')}); }); it('should support inheriting queries', () => { @Directive({selector: 'p'}) class Parent { - @ContentChild('p1', {static: false}) + @ContentChild('p1') p1: any; - @ContentChild('p21', {static: false}) + @ContentChild('p21') p2: any; } class Child extends Parent { - @ContentChild('p22', {static: false}) + @ContentChild('p22') p2: any; - @ContentChild('p3', {static: false}) + @ContentChild('p3') p3: any; } const directiveMetadata = resolver.resolve(Child); expect(directiveMetadata.queries).toEqual({ - 'p1': new ContentChild('p1', {static: false}), - 'p2': new ContentChild('p22', {static: false}), - 'p3': new ContentChild('p3', {static: false}) + 'p1': new ContentChild('p1'), + 'p2': new ContentChild('p22'), + 'p3': new ContentChild('p3') }); }); }); diff --git a/packages/core/schematics/test/google3/undecorated_classes_with_decorated_fields_spec.ts b/packages/core/schematics/test/google3/undecorated_classes_with_decorated_fields_spec.ts index 0f0687f38f..ce1bc7b0fe 100644 --- a/packages/core/schematics/test/google3/undecorated_classes_with_decorated_fields_spec.ts +++ b/packages/core/schematics/test/google3/undecorated_classes_with_decorated_fields_spec.ts @@ -183,7 +183,7 @@ describe('Google3 undecorated classes with decorated fields TSLint rule', () => import { ViewChild, ElementRef } from '@angular/core'; export class Base { - @ViewChild('button', { static: false }) button: ElementRef; + @ViewChild('button') button: ElementRef; } `); @@ -209,7 +209,7 @@ describe('Google3 undecorated classes with decorated fields TSLint rule', () => import { ContentChild, ElementRef } from '@angular/core'; export class Base { - @ContentChild('button', { static: false }) button: ElementRef; + @ContentChild('button') button: ElementRef; } `); diff --git a/packages/core/schematics/test/undecorated_classes_with_decorated_fields_migration_spec.ts b/packages/core/schematics/test/undecorated_classes_with_decorated_fields_migration_spec.ts index 7d1ff74e25..ed04c675d1 100644 --- a/packages/core/schematics/test/undecorated_classes_with_decorated_fields_migration_spec.ts +++ b/packages/core/schematics/test/undecorated_classes_with_decorated_fields_migration_spec.ts @@ -159,7 +159,7 @@ describe('Undecorated classes with decorated fields migration', () => { import { ViewChild, ElementRef } from '@angular/core'; export class Base { - @ViewChild('button', { static: false }) button: ElementRef; + @ViewChild('button') button: ElementRef; } `); @@ -185,7 +185,7 @@ describe('Undecorated classes with decorated fields migration', () => { import { ContentChild, ElementRef } from '@angular/core'; export class Base { - @ContentChild('button', { static: false }) button: ElementRef; + @ContentChild('button') button: ElementRef; } `); diff --git a/packages/core/test/acceptance/change_detection_spec.ts b/packages/core/test/acceptance/change_detection_spec.ts index f808dabbac..8cca530f35 100644 --- a/packages/core/test/acceptance/change_detection_spec.ts +++ b/packages/core/test/acceptance/change_detection_spec.ts @@ -80,7 +80,7 @@ describe('change detection', () => { }) class TestCmpt { counter = 0; - @ViewChild('vc', {read: ViewContainerRef, static: false}) vcRef !: ViewContainerRef; + @ViewChild('vc', {read: ViewContainerRef}) vcRef !: ViewContainerRef; constructor(private _cfr: ComponentFactoryResolver) {} @@ -146,7 +146,7 @@ describe('change detection', () => { @Component({selector: 'my-app', template: ''}) class MyApp { - @ViewChild(MyComponent, {static: false}) comp !: MyComponent; + @ViewChild(MyComponent) comp !: MyComponent; name: string = 'Nancy'; } @@ -238,7 +238,7 @@ describe('change detection', () => { template: '' }) class ButtonParent { - @ViewChild(MyComponent, {static: false}) comp !: MyComponent; + @ViewChild(MyComponent) comp !: MyComponent; noop() {} } @@ -264,7 +264,7 @@ describe('change detection', () => { changeDetection: ChangeDetectionStrategy.OnPush }) class ButtonParent implements DoCheck { - @ViewChild(MyComponent, {static: false}) comp !: MyComponent; + @ViewChild(MyComponent) comp !: MyComponent; noop() {} doCheckCount = 0; @@ -273,7 +273,7 @@ describe('change detection', () => { @Component({selector: 'my-button-app', template: ''}) class MyButtonApp { - @ViewChild(ButtonParent, {static: false}) parent !: ButtonParent; + @ViewChild(ButtonParent) parent !: ButtonParent; } TestBed.configureTestingModule({declarations: [MyButtonApp, MyComponent, ButtonParent]}); @@ -326,7 +326,7 @@ describe('change detection', () => { @Component({selector: 'parent-comp', template: `{{ doCheckCount}} - `}) class ParentComp implements DoCheck { - @ViewChild(MyComp, {static: false}) myComp !: MyComp; + @ViewChild(MyComp) myComp !: MyComp; doCheckCount = 0; @@ -411,8 +411,8 @@ describe('change detection', () => { it('should check component view when called by directive on component node', () => { @Component({template: ''}) class MyApp { - @ViewChild(MyComp, {static: false}) myComp !: MyComp; - @ViewChild(Dir, {static: false}) dir !: Dir; + @ViewChild(MyComp) myComp !: MyComp; + @ViewChild(Dir) dir !: Dir; } TestBed.configureTestingModule({declarations: [MyComp, Dir, MyApp]}); @@ -429,8 +429,8 @@ describe('change detection', () => { it('should check host component when called by directive on element node', () => { @Component({template: '{{ value }}
'}) class MyApp { - @ViewChild(MyComp, {static: false}) myComp !: MyComp; - @ViewChild(Dir, {static: false}) dir !: Dir; + @ViewChild(MyComp) myComp !: MyComp; + @ViewChild(Dir) dir !: Dir; value = ''; } @@ -450,7 +450,7 @@ describe('change detection', () => { it('should check the host component when called from EmbeddedViewRef', () => { @Component({template: '{{ name }}
'}) class MyApp { - @ViewChild(Dir, {static: false}) dir !: Dir; + @ViewChild(Dir) dir !: Dir; showing = true; name = 'Amelia'; } @@ -601,7 +601,7 @@ describe('change detection', () => { '{{ ctx.value }}' }) class App { - @ViewChild(StructuralComp, {static: false}) structuralComp !: StructuralComp; + @ViewChild(StructuralComp) structuralComp !: StructuralComp; } TestBed.configureTestingModule({declarations: [App, StructuralComp]}); @@ -630,7 +630,7 @@ describe('change detection', () => { template: 'Template text' }) class App { - @ViewChild(StructuralComp, {static: false}) structuralComp !: StructuralComp; + @ViewChild(StructuralComp) structuralComp !: StructuralComp; } TestBed.configureTestingModule({declarations: [App, StructuralComp]}); @@ -661,7 +661,7 @@ describe('change detection', () => { @Component({template: ''}) class MyApp { - @ViewChild(DetachedComp, {static: false}) comp !: DetachedComp; + @ViewChild(DetachedComp) comp !: DetachedComp; constructor(public cdr: ChangeDetectorRef) {} } @@ -772,7 +772,7 @@ describe('change detection', () => { @Component({template: ''}) class OnPushApp { - @ViewChild(OnPushComp, {static: false}) onPushComp !: OnPushComp; + @ViewChild(OnPushComp) onPushComp !: OnPushComp; value = ''; } @@ -819,7 +819,7 @@ describe('change detection', () => { changeDetection: ChangeDetectionStrategy.OnPush }) class OnPushParent { - @ViewChild(OnPushComp, {static: false}) comp !: OnPushComp; + @ViewChild(OnPushComp) comp !: OnPushComp; value = 'one'; } @@ -881,7 +881,7 @@ describe('change detection', () => { changeDetection: ChangeDetectionStrategy.OnPush }) class EmbeddedViewParent { - @ViewChild(OnPushComp, {static: false}) comp !: OnPushComp; + @ViewChild(OnPushComp) comp !: OnPushComp; value = 'one'; showing = true; } diff --git a/packages/core/test/acceptance/component_spec.ts b/packages/core/test/acceptance/component_spec.ts index 0997e46423..4283fc4618 100644 --- a/packages/core/test/acceptance/component_spec.ts +++ b/packages/core/test/acceptance/component_spec.ts @@ -239,7 +239,7 @@ describe('component', () => { encapsulation: ViewEncapsulation.Emulated, }) class Parent { - @ViewChild(Child, {static: false}) childInstance !: Child; + @ViewChild(Child) childInstance !: Child; constructor(public renderer: Renderer2) {} } diff --git a/packages/core/test/acceptance/di_spec.ts b/packages/core/test/acceptance/di_spec.ts index b2316cbffc..7b00a079ef 100644 --- a/packages/core/test/acceptance/di_spec.ts +++ b/packages/core/test/acceptance/di_spec.ts @@ -405,7 +405,7 @@ describe('di', () => { ` }) class MyComp { - @ViewChild(StructuralDirective, {static: false}) structuralDir !: StructuralDirective; + @ViewChild(StructuralDirective) structuralDir !: StructuralDirective; } TestBed.configureTestingModule( @@ -449,8 +449,8 @@ describe('di', () => { ` }) class MyApp { - @ViewChild(HostBindingDirective, {static: false}) hostBindingDir !: HostBindingDirective; - @ViewChild(DirectiveA, {static: false}) dirA !: DirectiveA; + @ViewChild(HostBindingDirective) hostBindingDir !: HostBindingDirective; + @ViewChild(DirectiveA) dirA !: DirectiveA; } TestBed.configureTestingModule( @@ -563,7 +563,7 @@ describe('di', () => { @Component({template: '
'}) class MyComp { - @ViewChild(DirectiveA, {static: false}) dirA !: DirectiveA; + @ViewChild(DirectiveA) dirA !: DirectiveA; } TestBed.configureTestingModule({declarations: [DirectiveA, DirectiveB, MyComp]}); @@ -583,7 +583,7 @@ describe('di', () => { @Component({template: '
'}) class MyComp { - @ViewChild(DirectiveC, {static: false}) dirC !: DirectiveC; + @ViewChild(DirectiveC) dirC !: DirectiveC; } TestBed.configureTestingModule({declarations: [DirectiveC, MyComp]}); @@ -603,7 +603,7 @@ describe('di', () => { @Component({template: '
'}) class MyComp { - @ViewChild(DirectiveC, {static: false}) dirC !: DirectiveC; + @ViewChild(DirectiveC) dirC !: DirectiveC; } TestBed.configureTestingModule({declarations: [DirectiveB, DirectiveC, MyComp]}); @@ -624,12 +624,12 @@ describe('di', () => { @Component({selector: 'my-comp', template: '
'}) class MyComp { - @ViewChild(DirectiveA, {static: false}) dirA !: DirectiveA; + @ViewChild(DirectiveA) dirA !: DirectiveA; } @Component({template: ''}) class MyApp { - @ViewChild(MyComp, {static: false}) myComp !: MyComp; + @ViewChild(MyComp) myComp !: MyComp; } TestBed.configureTestingModule({declarations: [DirectiveA, DirectiveB, MyComp, MyApp]}); @@ -674,12 +674,12 @@ describe('di', () => { viewProviders: [{provide: String, useValue: 'Foo'}] }) class MyComp { - @ViewChild(DirectiveString, {static: false}) dirString !: DirectiveString; + @ViewChild(DirectiveString) dirString !: DirectiveString; } @Component({template: ''}) class MyApp { - @ViewChild(MyComp, {static: false}) myComp !: MyComp; + @ViewChild(MyComp) myComp !: MyComp; } TestBed.configureTestingModule({declarations: [DirectiveString, MyComp, MyApp]}); @@ -698,12 +698,12 @@ describe('di', () => { @Component({selector: 'my-comp', template: '
'}) class MyComp { - @ViewChild(DirectiveComp, {static: false}) dirComp !: DirectiveComp; + @ViewChild(DirectiveComp) dirComp !: DirectiveComp; } @Component({template: ''}) class MyApp { - @ViewChild(MyComp, {static: false}) myComp !: MyComp; + @ViewChild(MyComp) myComp !: MyComp; } TestBed.configureTestingModule({declarations: [DirectiveComp, MyComp, MyApp]}); @@ -762,7 +762,7 @@ describe('di', () => { @Component({template: ''}) class MyApp { - @ViewChild(MyComp, {static: false}) myComp !: MyComp; + @ViewChild(MyComp) myComp !: MyComp; } TestBed.configureTestingModule( @@ -779,8 +779,8 @@ describe('di', () => { @Component({template: '
'}) class MyApp { showing = false; - @ViewChild(DirectiveA, {static: false}) dirA !: DirectiveA; - @ViewChild(DirectiveB, {static: false}) dirB !: DirectiveB; + @ViewChild(DirectiveA) dirA !: DirectiveA; + @ViewChild(DirectiveB) dirB !: DirectiveB; } TestBed.configureTestingModule({declarations: [DirectiveA, DirectiveB, MyApp]}); @@ -1042,8 +1042,8 @@ describe('di', () => { @Component({template: '
'}) class MyComp { - @ViewChild(InjectorDir, {static: false}) injectorDir !: InjectorDir; - @ViewChild(OtherInjectorDir, {static: false}) otherInjectorDir !: OtherInjectorDir; + @ViewChild(InjectorDir) injectorDir !: InjectorDir; + @ViewChild(OtherInjectorDir) otherInjectorDir !: OtherInjectorDir; } TestBed.configureTestingModule({declarations: [InjectorDir, OtherInjectorDir, MyComp]}); @@ -1068,7 +1068,7 @@ describe('di', () => { @Component({template: '
'}) class MyComp { - @ViewChild(InjectorDir, {static: false}) injectorDir !: InjectorDir; + @ViewChild(InjectorDir) injectorDir !: InjectorDir; } TestBed.configureTestingModule({declarations: [InjectorDir, MyComp]}); @@ -1105,8 +1105,8 @@ describe('di', () => { @Component({template: '
'}) class MyComp { - @ViewChild(MyDir, {static: false}) directive !: MyDir; - @ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir; + @ViewChild(MyDir) directive !: MyDir; + @ViewChild(MyOtherDir) otherDirective !: MyOtherDir; } TestBed.configureTestingModule({declarations: [MyDir, MyOtherDir, MyComp]}); @@ -1137,7 +1137,7 @@ describe('di', () => { @Component({template: ''}) class MyComp { - @ViewChild(MyDir, {static: false}) directive !: MyDir; + @ViewChild(MyDir) directive !: MyDir; } TestBed.configureTestingModule({declarations: [MyDir, MyComp]}); @@ -1172,7 +1172,7 @@ describe('di', () => { template: `
`, }) class ChildComp { - @ViewChild(DirectiveA, {static: false}) directive !: DirectiveA; + @ViewChild(DirectiveA) directive !: DirectiveA; } @Component({ @@ -1238,8 +1238,8 @@ describe('di', () => { template: '' }) class MyComp { - @ViewChild(MyDir, {static: false}) directive !: MyDir; - @ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir; + @ViewChild(MyDir) directive !: MyDir; + @ViewChild(MyOtherDir) otherDirective !: MyOtherDir; } TestBed.configureTestingModule({declarations: [MyDir, MyOtherDir, MyComp]}); @@ -1282,7 +1282,7 @@ describe('di', () => { } @Component({template: '
'}) class MyComp { - @ViewChild(OptionalDir, {static: false}) directive !: OptionalDir; + @ViewChild(OptionalDir) directive !: OptionalDir; } TestBed.configureTestingModule({declarations: [OptionalDir, MyComp]}); @@ -1311,8 +1311,8 @@ describe('di', () => { } @Component({template: '
'}) class MyComp { - @ViewChild(MyDir, {static: false}) directive !: MyDir; - @ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir; + @ViewChild(MyDir) directive !: MyDir; + @ViewChild(MyOtherDir) otherDirective !: MyOtherDir; } TestBed.configureTestingModule({declarations: [MyDir, MyOtherDir, MyComp]}); @@ -1408,9 +1408,9 @@ describe('di', () => { () => { @Component({selector: 'my-app', template: ''}) class MyApp { - @ViewChild(MyComp, {static: false}) component !: MyComp; - @ViewChild(MyDir, {static: false}) directive !: MyDir; - @ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir; + @ViewChild(MyComp) component !: MyComp; + @ViewChild(MyDir) directive !: MyDir; + @ViewChild(MyOtherDir) otherDirective !: MyOtherDir; } TestBed.configureTestingModule({declarations: [MyApp, MyComp, MyDir, MyOtherDir]}); const fixture = TestBed.createComponent(MyApp); @@ -1431,8 +1431,8 @@ describe('di', () => { @Component({selector: 'my-comp', template: '
'}) class MyComp { constructor(public cdr: ChangeDetectorRef) {} - @ViewChild(MyDir, {static: false}) directive !: MyDir; - @ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir; + @ViewChild(MyDir) directive !: MyDir; + @ViewChild(MyOtherDir) otherDirective !: MyOtherDir; } TestBed.configureTestingModule({declarations: [MyComp, MyDir, MyOtherDir]}); const fixture = TestBed.createComponent(MyComp); @@ -1458,9 +1458,9 @@ describe('di', () => { }) class MyApp { constructor(public cdr: ChangeDetectorRef) {} - @ViewChild(MyComp, {static: false}) component !: MyComp; - @ViewChild(MyDir, {static: false}) directive !: MyDir; - @ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir; + @ViewChild(MyComp) component !: MyComp; + @ViewChild(MyDir) directive !: MyDir; + @ViewChild(MyOtherDir) otherDirective !: MyOtherDir; } TestBed.configureTestingModule({declarations: [MyApp, MyComp, MyDir, MyOtherDir]}); const fixture = TestBed.createComponent(MyApp); @@ -1486,8 +1486,8 @@ describe('di', () => { class MyComp { showing = true; constructor(public cdr: ChangeDetectorRef) {} - @ViewChild(MyDir, {static: false}) directive !: MyDir; - @ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir; + @ViewChild(MyDir) directive !: MyDir; + @ViewChild(MyOtherDir) otherDirective !: MyOtherDir; } TestBed.configureTestingModule({declarations: [MyComp, MyDir, MyOtherDir]}); @@ -1509,8 +1509,8 @@ describe('di', () => { class MyComp { showing = true; constructor(public cdr: ChangeDetectorRef) {} - @ViewChild(MyDir, {static: false}) directive !: MyDir; - @ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir; + @ViewChild(MyDir) directive !: MyDir; + @ViewChild(MyOtherDir) otherDirective !: MyOtherDir; } TestBed.configureTestingModule({declarations: [MyComp, MyDir, MyOtherDir]}); @@ -1559,7 +1559,7 @@ describe('di', () => { @Component({template: '
'}) class MyComp { - @ViewChild(InjectorDir, {static: false}) injectorDirInstance !: InjectorDir; + @ViewChild(InjectorDir) injectorDirInstance !: InjectorDir; } TestBed.configureTestingModule({declarations: [InjectorDir, MyComp]}); @@ -1652,7 +1652,7 @@ describe('di', () => { providers: [{provide: LOCALE_ID, useValue: 'en-GB'}] }) class MyComp { - @ViewChild(MyDir, {static: false}) myDir !: MyDir; + @ViewChild(MyDir) myDir !: MyDir; constructor(@Inject(LOCALE_ID) public localeId: string) {} } @@ -1674,7 +1674,7 @@ describe('di', () => { @Component({template: '
'}) class MyComp { - @ViewChild(MyDir, {static: false}) directiveInstance !: MyDir; + @ViewChild(MyDir) directiveInstance !: MyDir; } TestBed.configureTestingModule({declarations: [MyDir, MyComp]}); @@ -1698,7 +1698,7 @@ describe('di', () => { @Component( {template: ''}) class MyComp { - @ViewChild(MyDir, {static: false}) directiveInstance !: MyDir; + @ViewChild(MyDir) directiveInstance !: MyDir; } TestBed.configureTestingModule({declarations: [MyDir, MyComp]}); @@ -1723,7 +1723,7 @@ describe('di', () => { template: '' }) class MyComp { - @ViewChild(MyDir, {static: false}) directiveInstance !: MyDir; + @ViewChild(MyDir) directiveInstance !: MyDir; } TestBed.configureTestingModule({declarations: [MyDir, MyComp]}); @@ -1750,7 +1750,7 @@ describe('di', () => { '
' }) class MyComp { - @ViewChild(MyDir, {static: false}) directiveInstance !: MyDir; + @ViewChild(MyDir) directiveInstance !: MyDir; } TestBed.configureTestingModule({declarations: [MyDir, MyComp]}); @@ -1778,7 +1778,7 @@ describe('di', () => { template: '
' }) class MyComp { - @ViewChild(MyDir, {static: false}) directiveInstance !: MyDir; + @ViewChild(MyDir) directiveInstance !: MyDir; } TestBed.configureTestingModule({declarations: [MyDir, MyComp]}); @@ -1809,7 +1809,7 @@ describe('di', () => { '
' }) class MyComp { - @ViewChild(MyDir, {static: false}) directiveInstance !: MyDir; + @ViewChild(MyDir) directiveInstance !: MyDir; } TestBed.configureTestingModule({declarations: [MyDir, MyComp]}); diff --git a/packages/core/test/acceptance/discover_utils_spec.ts b/packages/core/test/acceptance/discover_utils_spec.ts index fb356a6e59..21d8a5a6fd 100644 --- a/packages/core/test/acceptance/discover_utils_spec.ts +++ b/packages/core/test/acceptance/discover_utils_spec.ts @@ -312,9 +312,9 @@ onlyInIvy('Ivy-specific utilities').describe('discovery utils deprecated', () => ` }) class Comp { - @ViewChild(MyDir1, {static: false}) myDir1Instance !: MyDir1; - @ViewChild(MyDir2, {static: false}) myDir2Instance !: MyDir2; - @ViewChild(MyDir3, {static: false}) myDir3Instance !: MyDir3; + @ViewChild(MyDir1) myDir1Instance !: MyDir1; + @ViewChild(MyDir2) myDir2Instance !: MyDir2; + @ViewChild(MyDir3) myDir3Instance !: MyDir3; } TestBed.configureTestingModule({declarations: [Comp, MyDir1, MyDir2, MyDir3]}); diff --git a/packages/core/test/acceptance/host_binding_spec.ts b/packages/core/test/acceptance/host_binding_spec.ts index 5ac5d32c0a..320209c0b3 100644 --- a/packages/core/test/acceptance/host_binding_spec.ts +++ b/packages/core/test/acceptance/host_binding_spec.ts @@ -121,7 +121,7 @@ describe('host bindings', () => { class ParentCmp { private _prop = ''; - @ViewChild('template', {read: ViewContainerRef, static: false}) + @ViewChild('template', {read: ViewContainerRef}) vcr: ViewContainerRef = null !; private child: ComponentRef = null !; @@ -314,7 +314,7 @@ describe('host bindings', () => { @Component({template: ''}) class App { - @ViewChild(Dir, {static: false}) directiveInstance !: Dir; + @ViewChild(Dir) directiveInstance !: Dir; } TestBed.configureTestingModule({declarations: [App, Dir]}); @@ -403,7 +403,7 @@ describe('host bindings', () => { ` }) class App { - @ViewChild(HostBindingDir, {static: false}) hostBindingDir !: HostBindingDir; + @ViewChild(HostBindingDir) hostBindingDir !: HostBindingDir; } TestBed.configureTestingModule({declarations: [App, SomeDir, HostTitleComp, HostBindingDir]}); @@ -471,7 +471,7 @@ describe('host bindings', () => { @Component({template: '
'}) class App { - @ViewChild(HostBindingDir, {static: false}) hostBindingDir !: HostBindingDir; + @ViewChild(HostBindingDir) hostBindingDir !: HostBindingDir; } TestBed.configureTestingModule({declarations: [App, SomeDir, HostBindingDir]}); @@ -539,7 +539,7 @@ describe('host bindings', () => { @Component({template: ''}) class App { - @ViewChild(HostBindingInputDir, {static: false}) hostBindingInputDir !: HostBindingInputDir; + @ViewChild(HostBindingInputDir) hostBindingInputDir !: HostBindingInputDir; isDisabled = true; } @@ -629,7 +629,7 @@ describe('host bindings', () => { ` }) class App { - @ViewChild(NameComp, {static: false}) nameComp !: NameComp; + @ViewChild(NameComp) nameComp !: NameComp; name = ''; } @@ -685,8 +685,8 @@ describe('host bindings', () => { ` }) class App { - @ViewChild(HostBindingComp, {static: false}) hostBindingComp !: HostBindingComp; - @ViewChild(NameComp, {static: false}) nameComp !: NameComp; + @ViewChild(HostBindingComp) hostBindingComp !: HostBindingComp; + @ViewChild(NameComp) nameComp !: NameComp; name = ''; otherName = ''; } @@ -760,8 +760,8 @@ describe('host bindings', () => { @Component({template: ''}) class App { - @ViewChild(HostBindingComp, {static: false}) hostBindingComp !: HostBindingComp; - @ViewChild(HostBindingDir, {static: false}) hostBindingDir !: HostBindingDir; + @ViewChild(HostBindingComp) hostBindingComp !: HostBindingComp; + @ViewChild(HostBindingDir) hostBindingDir !: HostBindingDir; } TestBed.configureTestingModule({declarations: [App, HostBindingComp, HostBindingDir]}); @@ -799,7 +799,7 @@ describe('host bindings', () => { @Component({template: `{{ name }}`}) class App { - @ViewChild(HostBindingComp, {static: false}) hostBindingComp !: HostBindingComp; + @ViewChild(HostBindingComp) hostBindingComp !: HostBindingComp; name = ''; } @@ -849,8 +849,8 @@ describe('host bindings', () => { ` }) class App { - @ViewChild(SubDirective, {static: false}) subDir !: SubDirective; - @ViewChild(SuperDirective, {static: false}) superDir !: SuperDirective; + @ViewChild(SubDirective) subDir !: SubDirective; + @ViewChild(SuperDirective) superDir !: SuperDirective; } TestBed.configureTestingModule({declarations: [App, SuperDirective, SubDirective]}); @@ -958,7 +958,7 @@ describe('host bindings', () => { @Component({template: ''}) class App { - @ViewChild(HostBindingToStyles, {static: false}) hostBindingDir !: HostBindingToStyles; + @ViewChild(HostBindingToStyles) hostBindingDir !: HostBindingToStyles; } TestBed.configureTestingModule({declarations: [App, HostBindingToStyles]}); @@ -987,7 +987,7 @@ describe('host bindings', () => { @Component({template: '
'}) class App { - @ViewChild(HostBindingToStyles, {static: false}) hostBindingDir !: HostBindingToStyles; + @ViewChild(HostBindingToStyles) hostBindingDir !: HostBindingToStyles; } TestBed.configureTestingModule({declarations: [App, HostBindingToStyles, ContainerDir]}); @@ -1038,7 +1038,7 @@ describe('host bindings', () => { @Component({template: `<${tag} unsafeUrlHostBindingDir>`}) class App { - @ViewChild(UnsafeDir, {static: false}) unsafeDir !: UnsafeDir; + @ViewChild(UnsafeDir) unsafeDir !: UnsafeDir; } TestBed.configureTestingModule({declarations: [App, UnsafeDir]}); diff --git a/packages/core/test/acceptance/integration_spec.ts b/packages/core/test/acceptance/integration_spec.ts index 7b9356f3e1..1ff23d0780 100644 --- a/packages/core/test/acceptance/integration_spec.ts +++ b/packages/core/test/acceptance/integration_spec.ts @@ -243,7 +243,7 @@ describe('acceptance integration tests', () => { @Component({template: '
'}) class App { - @ViewChild(TestDirective, {static: false}) testDirective !: TestDirective; + @ViewChild(TestDirective) testDirective !: TestDirective; } TestBed.configureTestingModule({declarations: [App, TestDirective]}); @@ -273,7 +273,7 @@ describe('acceptance integration tests', () => { 'Content' }) class App { - @ViewChild(TestDirective, {static: false}) testDirective !: TestDirective; + @ViewChild(TestDirective) testDirective !: TestDirective; } TestBed.configureTestingModule({declarations: [App, TestDirective]}); @@ -303,7 +303,7 @@ describe('acceptance integration tests', () => { @Component({template: 'Content'}) class App { - @ViewChild(TestDirective, {static: false}) testDirective !: TestDirective; + @ViewChild(TestDirective) testDirective !: TestDirective; } TestBed.configureTestingModule({declarations: [App, TestDirective]}); @@ -608,7 +608,7 @@ describe('acceptance integration tests', () => { @Component({template: ''}) class App { - @ViewChild(TodoComponentHostBinding, {static: false}) + @ViewChild(TodoComponentHostBinding) todoComponentHostBinding !: TodoComponentHostBinding; } @@ -844,7 +844,7 @@ describe('acceptance integration tests', () => { @Component({template: '
'}) class App { - @ViewChild(HostBindingDir, {static: false}) hostBindingDir !: HostBindingDir; + @ViewChild(HostBindingDir) hostBindingDir !: HostBindingDir; } TestBed.configureTestingModule({declarations: [App, HostBindingDir]}); @@ -1012,7 +1012,7 @@ describe('acceptance integration tests', () => { ` }) class App { - @ViewChild(StructuralComp, {static: false}) structuralComp !: StructuralComp; + @ViewChild(StructuralComp) structuralComp !: StructuralComp; value: any; } @@ -1053,7 +1053,7 @@ describe('acceptance integration tests', () => { () => { @Component({template: '
'}) class App { - @ViewChild(DirWithClassDirective, {static: false}) + @ViewChild(DirWithClassDirective) mockClassDirective !: DirWithClassDirective; } @@ -1071,7 +1071,7 @@ describe('acceptance integration tests', () => { () => { @Component({template: '
'}) class App { - @ViewChild(DirWithStyleDirective, {static: false}) + @ViewChild(DirWithStyleDirective) mockStyleDirective !: DirWithStyleDirective; } @@ -1090,7 +1090,7 @@ describe('acceptance integration tests', () => { () => { @Component({template: '
'}) class App { - @ViewChild(DirWithClassDirective, {static: false}) + @ViewChild(DirWithClassDirective) mockClassDirective !: DirWithClassDirective; value = ''; } @@ -1109,7 +1109,7 @@ describe('acceptance integration tests', () => { () => { @Component({template: '
'}) class App { - @ViewChild(DirWithStyleDirective, {static: false}) + @ViewChild(DirWithStyleDirective) mockStyleDirective !: DirWithStyleDirective; value !: {[key: string]: string}; } @@ -1186,7 +1186,7 @@ describe('acceptance integration tests', () => { ` }) class App { - @ViewChild(DirWithSingleStylingBindings, {static: false}) + @ViewChild(DirWithSingleStylingBindings) dirInstance !: DirWithSingleStylingBindings; } @@ -1242,8 +1242,8 @@ describe('acceptance integration tests', () => { @Component( {template: '
'}) class App { - @ViewChild(Dir1WithStyle, {static: false}) dir1Instance !: Dir1WithStyle; - @ViewChild(Dir2WithStyle, {static: false}) dir2Instance !: Dir2WithStyle; + @ViewChild(Dir1WithStyle) dir1Instance !: Dir1WithStyle; + @ViewChild(Dir2WithStyle) dir2Instance !: Dir2WithStyle; width: string|null = null; } @@ -1307,8 +1307,8 @@ describe('acceptance integration tests', () => { '
' }) class App { - @ViewChild(Dir1WithStyling, {static: false}) dir1Instance !: Dir1WithStyling; - @ViewChild(Dir2WithStyling, {static: false}) dir2Instance !: Dir2WithStyling; + @ViewChild(Dir1WithStyling) dir1Instance !: Dir1WithStyling; + @ViewChild(Dir2WithStyling) dir2Instance !: Dir2WithStyling; stylesExp: any = {}; classesExp: any = {}; } diff --git a/packages/core/test/acceptance/lifecycle_spec.ts b/packages/core/test/acceptance/lifecycle_spec.ts index 77d6d37161..5175d3dd7d 100644 --- a/packages/core/test/acceptance/lifecycle_spec.ts +++ b/packages/core/test/acceptance/lifecycle_spec.ts @@ -1293,7 +1293,7 @@ describe('onInit', () => { `, }) class App { - @ViewChild('container', {read: ViewContainerRef, static: false}) + @ViewChild('container', {read: ViewContainerRef}) viewContainerRef !: ViewContainerRef; constructor(public compFactoryResolver: ComponentFactoryResolver) {} diff --git a/packages/core/test/acceptance/listener_spec.ts b/packages/core/test/acceptance/listener_spec.ts index 4dc39d9bba..8c42981b12 100644 --- a/packages/core/test/acceptance/listener_spec.ts +++ b/packages/core/test/acceptance/listener_spec.ts @@ -220,7 +220,7 @@ describe('event listeners', () => { count = 0; someValue = -1; - @ViewChild(FooDirective, {static: false}) fooDirective: FooDirective|null = null; + @ViewChild(FooDirective) fooDirective: FooDirective|null = null; fooChange() { this.count++; } diff --git a/packages/core/test/acceptance/outputs_spec.ts b/packages/core/test/acceptance/outputs_spec.ts index 35716f1625..873b663388 100644 --- a/packages/core/test/acceptance/outputs_spec.ts +++ b/packages/core/test/acceptance/outputs_spec.ts @@ -43,7 +43,7 @@ describe('outputs', () => { @Component({template: ''}) class App { - @ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle; + @ViewChild(ButtonToggle) buttonToggle !: ButtonToggle; onChange() { counter++; } } TestBed.configureTestingModule({declarations: [App, ButtonToggle]}); @@ -64,7 +64,7 @@ describe('outputs', () => { @Component( {template: ''}) class App { - @ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle; + @ViewChild(ButtonToggle) buttonToggle !: ButtonToggle; onChange() { counter++; } onReset() { resetCounter++; } } @@ -82,7 +82,7 @@ describe('outputs', () => { it('should eval component output expression when event is emitted', () => { @Component({template: ''}) class App { - @ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle; + @ViewChild(ButtonToggle) buttonToggle !: ButtonToggle; counter = 0; } TestBed.configureTestingModule({declarations: [App, ButtonToggle]}); @@ -102,7 +102,7 @@ describe('outputs', () => { @Component( {template: ''}) class App { - @ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle; + @ViewChild(ButtonToggle) buttonToggle !: ButtonToggle; condition = true; onChange() { counter++; } @@ -133,7 +133,7 @@ describe('outputs', () => { ` }) class App { - @ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle; + @ViewChild(ButtonToggle) buttonToggle !: ButtonToggle; condition = true; condition2 = true; @@ -168,8 +168,8 @@ describe('outputs', () => { ` }) class App { - @ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle; - @ViewChild(DestroyComp, {static: false}) destroyComp !: DestroyComp; + @ViewChild(ButtonToggle) buttonToggle !: ButtonToggle; + @ViewChild(DestroyComp) destroyComp !: DestroyComp; condition = true; onClick() { clickCounter++; } @@ -206,7 +206,7 @@ describe('outputs', () => { @Component({template: ''}) class App { - @ViewChild(MyButton, {static: false}) buttonDir !: MyButton; + @ViewChild(MyButton) buttonDir !: MyButton; onClick() { counter++; } } TestBed.configureTestingModule({declarations: [App, MyButton]}); @@ -228,8 +228,8 @@ describe('outputs', () => { @Component({template: ''}) class App { - @ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle; - @ViewChild(OtherDir, {static: false}) otherDir !: OtherDir; + @ViewChild(ButtonToggle) buttonToggle !: ButtonToggle; + @ViewChild(OtherDir) otherDir !: OtherDir; onChange() { counter++; } } TestBed.configureTestingModule({declarations: [App, ButtonToggle, OtherDir]}); @@ -257,8 +257,8 @@ describe('outputs', () => { '' }) class App { - @ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle; - @ViewChild(OtherChangeDir, {static: false}) otherDir !: OtherChangeDir; + @ViewChild(ButtonToggle) buttonToggle !: ButtonToggle; + @ViewChild(OtherChangeDir) otherDir !: OtherChangeDir; change = true; onChange() { counter++; } diff --git a/packages/core/test/acceptance/pipe_spec.ts b/packages/core/test/acceptance/pipe_spec.ts index d58a7c5169..3dd1be88eb 100644 --- a/packages/core/test/acceptance/pipe_spec.ts +++ b/packages/core/test/acceptance/pipe_spec.ts @@ -70,7 +70,7 @@ describe('pipe', () => { template: `
`, }) class App { - @ViewChild(Dir, {static: false}) directive !: Dir; + @ViewChild(Dir) directive !: Dir; } TestBed.configureTestingModule({declarations: [App, DoublePipe, Dir]}); @@ -421,7 +421,7 @@ describe('pipe', () => { }) class App { @Input() something: any; - @ViewChild(SomeComp, {static: false}) comp !: SomeComp; + @ViewChild(SomeComp) comp !: SomeComp; pipeValue = 10; displayValue = 0; } @@ -473,7 +473,7 @@ describe('pipe', () => { }) class App { @Input() something: any; - @ViewChild(SomeComp, {static: false}) comp !: SomeComp; + @ViewChild(SomeComp) comp !: SomeComp; pipeValue = 10; displayValue = 0; } diff --git a/packages/core/test/acceptance/query_spec.ts b/packages/core/test/acceptance/query_spec.ts index 1c02c0483f..fb499187d8 100644 --- a/packages/core/test/acceptance/query_spec.ts +++ b/packages/core/test/acceptance/query_spec.ts @@ -177,7 +177,7 @@ describe('query logic', () => { it('should support ViewChild query inherited from undecorated superclasses', () => { class MyComp { - @ViewChild('foo', {static: false}) foo: any; + @ViewChild('foo') foo: any; } @Component({selector: 'sub-comp', template: '
'}) @@ -193,7 +193,7 @@ describe('query logic', () => { it('should support ViewChild query inherited from undecorated grand superclasses', () => { class MySuperComp { - @ViewChild('foo', {static: false}) foo: any; + @ViewChild('foo') foo: any; } class MyComp extends MySuperComp {} @@ -287,7 +287,7 @@ describe('query logic', () => { ` }) class App { - @ViewChild(Required, {static: false}) requiredEl !: Required; + @ViewChild(Required) requiredEl !: Required; viewChildAvailableInAfterViewInit?: boolean; ngAfterViewInit() { @@ -529,7 +529,7 @@ describe('query logic', () => { it('should support ContentChild query inherited from undecorated superclasses', () => { class MyComp { - @ContentChild('foo', {static: false}) foo: any; + @ContentChild('foo') foo: any; } @Component({selector: 'sub-comp', template: ''}) @@ -538,7 +538,7 @@ describe('query logic', () => { @Component({template: '
'}) class App { - @ViewChild(SubComp, {static: false}) subComp !: SubComp; + @ViewChild(SubComp) subComp !: SubComp; } TestBed.configureTestingModule({declarations: [App, SubComp]}); @@ -550,7 +550,7 @@ describe('query logic', () => { it('should support ContentChild query inherited from undecorated grand superclasses', () => { class MySuperComp { - @ContentChild('foo', {static: false}) foo: any; + @ContentChild('foo') foo: any; } class MyComp extends MySuperComp {} @@ -561,7 +561,7 @@ describe('query logic', () => { @Component({template: '
'}) class App { - @ViewChild(SubComp, {static: false}) subComp !: SubComp; + @ViewChild(SubComp) subComp !: SubComp; } TestBed.configureTestingModule({declarations: [App, SubComp]}); @@ -593,7 +593,7 @@ describe('query logic', () => { ` }) class App { - @ViewChild(SubComp, {static: false}) subComp !: SubComp; + @ViewChild(SubComp) subComp !: SubComp; } TestBed.configureTestingModule({declarations: [App, SubComp, SomeDir]}); @@ -628,7 +628,7 @@ describe('query logic', () => { ` }) class App { - @ViewChild(SubComp, {static: false}) subComp !: SubComp; + @ViewChild(SubComp) subComp !: SubComp; } TestBed.configureTestingModule({declarations: [App, SubComp, SomeDir]}); @@ -881,21 +881,21 @@ describe('query logic', () => {
- +
- +
- + `, }) class TestComponent { - @ViewChild(ViewContainerManipulatorDirective, {static: false}) + @ViewChild(ViewContainerManipulatorDirective) vc !: ViewContainerManipulatorDirective; - @ViewChild('tpl1', {static: false}) tpl1 !: TemplateRef; - @ViewChild('tpl2', {static: false}) tpl2 !: TemplateRef; + @ViewChild('tpl1') tpl1 !: TemplateRef; + @ViewChild('tpl2') tpl2 !: TemplateRef; @ViewChildren('foo') query !: QueryList; } @@ -960,13 +960,13 @@ describe('query logic', () => { - + `, }) class TestComponent { - @ViewChild('tpl', {static: false}) tpl !: TemplateRef; - @ViewChild('vi0', {static: false}) vi0 !: ViewContainerManipulatorDirective; - @ViewChild('vi1', {static: false}) vi1 !: ViewContainerManipulatorDirective; + @ViewChild('tpl') tpl !: TemplateRef; + @ViewChild('vi0') vi0 !: ViewContainerManipulatorDirective; + @ViewChild('vi1') vi1 !: ViewContainerManipulatorDirective; @ViewChildren('foo') query !: QueryList; } @@ -1009,7 +1009,7 @@ describe('query logic', () => { - + `, }) @@ -1139,8 +1139,8 @@ function initWithTemplate(compType: Type, template: string) { @Component({selector: 'local-ref-query-component', template: ''}) class QueryComp { - @ViewChild('viewQuery', {static: false}) viewChild !: any; - @ContentChild('contentQuery', {static: false}) contentChild !: any; + @ViewChild('viewQuery') viewChild !: any; + @ContentChild('contentQuery') contentChild !: any; @ViewChildren('viewQuery') viewChildren !: QueryList; @ContentChildren('contentQuery') contentChildren !: QueryList; @@ -1183,7 +1183,7 @@ class StaticViewQueryComp { this._textDir = value; } - @ViewChild('foo', {static: false}) + @ViewChild('foo') get foo(): ElementRef { return this._foo; } set foo(value: ElementRef) { @@ -1208,7 +1208,7 @@ class SubclassStaticViewQueryComp extends StaticViewQueryComp { @ViewChild('bar', {static: true}) bar !: ElementRef; - @ViewChild('baz', {static: false}) + @ViewChild('baz') baz !: ElementRef; } @@ -1227,7 +1227,7 @@ class StaticContentQueryComp { this._textDir = value; } - @ContentChild('foo', {static: false}) + @ContentChild('foo') get foo(): ElementRef { return this._foo; } set foo(value: ElementRef) { @@ -1250,7 +1250,7 @@ class StaticContentQueryDir { this._textDir = value; } - @ContentChild('foo', {static: false}) + @ContentChild('foo') get foo(): ElementRef { return this._foo; } set foo(value: ElementRef) { @@ -1264,7 +1264,7 @@ class SubclassStaticContentQueryComp extends StaticContentQueryComp { @ContentChild('bar', {static: true}) bar !: ElementRef; - @ContentChild('baz', {static: false}) + @ContentChild('baz') baz !: ElementRef; } diff --git a/packages/core/test/acceptance/styling_spec.ts b/packages/core/test/acceptance/styling_spec.ts index e0c02739c6..1d8c8ffb3e 100644 --- a/packages/core/test/acceptance/styling_spec.ts +++ b/packages/core/test/acceptance/styling_spec.ts @@ -753,7 +753,7 @@ describe('styling', () => { template: '', }) class App { - @ViewChild(Dir, {static: false}) dir !: Dir; + @ViewChild(Dir) dir !: Dir; classes = 'math'; style = '80s'; @@ -1966,7 +1966,7 @@ describe('styling', () => { class ParentCmp { private _prop = ''; - @ViewChild('template', {read: ViewContainerRef, static: false}) + @ViewChild('template', {read: ViewContainerRef}) vcr: ViewContainerRef = null !; private child: ComponentRef = null !; @@ -2051,7 +2051,7 @@ describe('styling', () => { class ParentCmp { updateChild = false; - @ViewChild('template', {read: ViewContainerRef, static: false}) + @ViewChild('template', {read: ViewContainerRef}) vcr: ViewContainerRef = null !; private child: ComponentRef = null !; diff --git a/packages/core/test/acceptance/template_ref_spec.ts b/packages/core/test/acceptance/template_ref_spec.ts index 447f893876..d13bbcdb7e 100644 --- a/packages/core/test/acceptance/template_ref_spec.ts +++ b/packages/core/test/acceptance/template_ref_spec.ts @@ -37,7 +37,7 @@ describe('TemplateRef', () => { ` }) class App { - @ViewChild(MenuContent, {static: false}) content !: MenuContent; + @ViewChild(MenuContent) content !: MenuContent; constructor(public viewContainerRef: ViewContainerRef) {} } diff --git a/packages/core/test/acceptance/view_container_ref_spec.ts b/packages/core/test/acceptance/view_container_ref_spec.ts index 8cfa217073..e393c932f4 100644 --- a/packages/core/test/acceptance/view_container_ref_spec.ts +++ b/packages/core/test/acceptance/view_container_ref_spec.ts @@ -141,7 +141,7 @@ describe('ViewContainerRef', () => { ` }) class TestComp { - @ViewChild('container', {read: ViewContainerRef, static: false}) vcRef !: ViewContainerRef; + @ViewChild('container', {read: ViewContainerRef}) vcRef !: ViewContainerRef; constructor(public cfr: ComponentFactoryResolver) {} @@ -2128,7 +2128,7 @@ class ViewContainerRefComp { ` }) class ViewContainerRefApp { - @ViewChild(ViewContainerRefComp, {static: false}) vcrComp !: ViewContainerRefComp; + @ViewChild(ViewContainerRefComp) vcrComp !: ViewContainerRefComp; } @Directive({selector: '[structDir]'}) diff --git a/packages/core/test/acceptance/view_insertion_spec.ts b/packages/core/test/acceptance/view_insertion_spec.ts index f502e55133..b02373d27b 100644 --- a/packages/core/test/acceptance/view_insertion_spec.ts +++ b/packages/core/test/acceptance/view_insertion_spec.ts @@ -89,10 +89,10 @@ describe('view insertion', () => { ` }) class App { - @ViewChild('container', {read: ViewContainerRef, static: false}) + @ViewChild('container', {read: ViewContainerRef}) container: ViewContainerRef = null !; - @ViewChild('empty', {read: TemplateRef, static: false}) + @ViewChild('empty', {read: TemplateRef}) empty: TemplateRef = null !; view0: EmbeddedViewRef = null !; @@ -139,10 +139,10 @@ describe('view insertion', () => { ` }) class Comp { - @ViewChild('container', {read: ViewContainerRef, static: false}) + @ViewChild('container', {read: ViewContainerRef}) container: ViewContainerRef = null !; - @ViewChild('projection', {read: TemplateRef, static: false}) + @ViewChild('projection', {read: TemplateRef}) projection: TemplateRef = null !; view0: EmbeddedViewRef = null !; @@ -200,10 +200,10 @@ describe('view insertion', () => { ` }) class App { - @ViewChild('container', {read: ViewContainerRef, static: false}) + @ViewChild('container', {read: ViewContainerRef}) container: ViewContainerRef = null !; - @ViewChild('subContainer', {read: TemplateRef, static: false}) + @ViewChild('subContainer', {read: TemplateRef}) subContainer: TemplateRef = null !; view0: EmbeddedViewRef = null !; diff --git a/packages/core/test/animation/animation_integration_spec.ts b/packages/core/test/animation/animation_integration_spec.ts index fc56c91531..4087eff1f4 100644 --- a/packages/core/test/animation/animation_integration_spec.ts +++ b/packages/core/test/animation/animation_integration_spec.ts @@ -376,7 +376,7 @@ const DEFAULT_COMPONENT_ID = '1'; ] }) class Cmp { - @ViewChild('element', {static: false}) + @ViewChild('element') element: any; exp: any = ''; } @@ -1463,7 +1463,7 @@ const DEFAULT_COMPONENT_ID = '1'; ])] }) class Cmp { - @ViewChild('green', {static: false}) public element: any; + @ViewChild('green') public element: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1799,7 +1799,7 @@ const DEFAULT_COMPONENT_ID = '1'; class Cmp { public exp: any; - @ViewChild('parent', {static: false}) public parentElement: any; + @ViewChild('parent') public parentElement: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1853,9 +1853,9 @@ const DEFAULT_COMPONENT_ID = '1'; public exp1: any; public exp2: any; - @ViewChild('parent', {static: false}) public parent: any; + @ViewChild('parent') public parent: any; - @ViewChild('child', {static: false}) public child: any; + @ViewChild('child') public child: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1910,11 +1910,11 @@ const DEFAULT_COMPONENT_ID = '1'; public exp1: any; public exp2: any; - @ViewChild('parent', {static: false}) public parent: any; + @ViewChild('parent') public parent: any; - @ViewChild('child1', {static: false}) public child1Elm: any; + @ViewChild('child1') public child1Elm: any; - @ViewChild('child2', {static: false}) public child2Elm: any; + @ViewChild('child2') public child2Elm: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2269,7 +2269,7 @@ const DEFAULT_COMPONENT_ID = '1'; [transition(':enter', [style({opacity: 0}), animate('1s', style({opacity: 1}))])])] }) class OuterCmp { - @ViewChild('inner', {static: false}) public inner: any; + @ViewChild('inner') public inner: any; public exp: any = null; update() { this.exp = 'go'; } @@ -3260,7 +3260,7 @@ const DEFAULT_COMPONENT_ID = '1'; ] }) class Cmp { - @ViewChild('parent', {static: false}) public parentElm: any; + @ViewChild('parent') public parentElm: any; disableExp = false; exp = false; } @@ -3351,7 +3351,7 @@ const DEFAULT_COMPONENT_ID = '1'; ` }) class ParentCmp { - @ViewChild('child', {static: false}) public child: ChildCmp|null = null; + @ViewChild('child') public child: ChildCmp|null = null; disableExp = false; } @@ -3467,7 +3467,7 @@ const DEFAULT_COMPONENT_ID = '1'; ` }) class Cmp { - @ViewChild('container', {static: false}) public container: any; + @ViewChild('container') public container: any; disableExp = false; exp = ''; diff --git a/packages/core/test/animation/animation_query_integration_spec.ts b/packages/core/test/animation/animation_query_integration_spec.ts index e834c66887..37be2f2718 100644 --- a/packages/core/test/animation/animation_query_integration_spec.ts +++ b/packages/core/test/animation/animation_query_integration_spec.ts @@ -888,7 +888,7 @@ import {HostListener} from '../../src/metadata/directives'; ] }) class Cmp { - @ViewChild('container', {static: false}) public container: any; + @ViewChild('container') public container: any; public items: any[] = []; } @@ -1202,9 +1202,9 @@ import {HostListener} from '../../src/metadata/directives'; public exp1: any = ''; public exp2: any = true; - @ViewChild('ancestor', {static: false}) public ancestorElm: any; + @ViewChild('ancestor') public ancestorElm: any; - @ViewChild('parent', {static: false}) public parentElm: any; + @ViewChild('parent') public parentElm: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1281,9 +1281,9 @@ import {HostListener} from '../../src/metadata/directives'; public exp2: any = ''; public parentExp: any = true; - @ViewChild('ancestor', {static: false}) public ancestorElm: any; + @ViewChild('ancestor') public ancestorElm: any; - @ViewChild('parent', {static: false}) public parentElm: any; + @ViewChild('parent') public parentElm: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1637,7 +1637,7 @@ import {HostListener} from '../../src/metadata/directives'; class ParentCmp { public exp: any; - @ViewChild('child', {static: false}) public child: any; + @ViewChild('child') public child: any; } @Component({ @@ -1849,9 +1849,9 @@ import {HostListener} from '../../src/metadata/directives'; public exp1: any; public exp2: any; - @ViewChild('parent', {static: false}) public elm1: any; + @ViewChild('parent') public elm1: any; - @ViewChild('child', {static: false}) public elm2: any; + @ViewChild('child') public elm2: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1911,7 +1911,7 @@ import {HostListener} from '../../src/metadata/directives'; public exp: any; public items: any[] = [0, 1, 2, 3, 4]; - @ViewChild('parent', {static: false}) public elm: any; + @ViewChild('parent') public elm: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1981,7 +1981,7 @@ import {HostListener} from '../../src/metadata/directives'; public exp: any; public items: any[] = [0, 1, 2, 3, 4]; - @ViewChild('parent', {static: false}) public elm: any; + @ViewChild('parent') public elm: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2034,7 +2034,7 @@ import {HostListener} from '../../src/metadata/directives'; public exp1: any; public exp2: any; - @ViewChild('parent', {static: false}) public elm: any; + @ViewChild('parent') public elm: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2104,7 +2104,7 @@ import {HostListener} from '../../src/metadata/directives'; public exp1: any; public exp2: any; - @ViewChild('parent', {static: false}) public elm: any; + @ViewChild('parent') public elm: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2157,7 +2157,7 @@ import {HostListener} from '../../src/metadata/directives'; public exp1: any; public exp2: any; - @ViewChild('parent', {static: false}) public elm: any; + @ViewChild('parent') public elm: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2209,7 +2209,7 @@ import {HostListener} from '../../src/metadata/directives'; public exp1: any; public exp2: any; - @ViewChild('parent', {static: false}) public elm: any; + @ViewChild('parent') public elm: any; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2258,7 +2258,7 @@ import {HostListener} from '../../src/metadata/directives'; }) class ParentCmp { public exp: boolean = true; - @ViewChild('child', {static: false}) public childElm: any; + @ViewChild('child') public childElm: any; public childEvent: any; @@ -2694,7 +2694,7 @@ import {HostListener} from '../../src/metadata/directives'; class ParentCmp { public exp: any; - @ViewChild('child', {static: false}) public childCmp: any; + @ViewChild('child') public childCmp: any; } @Component({ @@ -2758,7 +2758,7 @@ import {HostListener} from '../../src/metadata/directives'; ` }) class ParentCmp { - @ViewChild('child', {static: false}) public childCmp: any; + @ViewChild('child') public childCmp: any; public exp: any; public log: string[] = []; @@ -2936,7 +2936,7 @@ import {HostListener} from '../../src/metadata/directives'; class ParentCmp { public exp: any; - @ViewChild('child', {static: false}) public childCmp: any; + @ViewChild('child') public childCmp: any; } @Component({ @@ -3015,13 +3015,13 @@ import {HostListener} from '../../src/metadata/directives'; class ParentCmp { public exp: any; - @ViewChild('child', {static: false}) public innerCmp: any; + @ViewChild('child') public innerCmp: any; } @Component( {selector: 'child-cmp', template: ''}) class ChildCmp { - @ViewChild('grandchild', {static: false}) public innerCmp: any; + @ViewChild('grandchild') public innerCmp: any; } @Component({ diff --git a/packages/core/test/animation/animations_with_css_keyframes_animations_integration_spec.ts b/packages/core/test/animation/animations_with_css_keyframes_animations_integration_spec.ts index 2d46bdebda..9590b53344 100644 --- a/packages/core/test/animation/animations_with_css_keyframes_animations_integration_spec.ts +++ b/packages/core/test/animation/animations_with_css_keyframes_animations_integration_spec.ts @@ -165,7 +165,7 @@ import {TestBed} from '../../testing'; ] }) class Cmp { - @ViewChild('elm', {static: false}) public element: any; + @ViewChild('elm') public element: any; public myAnimationExp = ''; } @@ -216,7 +216,7 @@ import {TestBed} from '../../testing'; ] }) class Cmp { - @ViewChild('elm', {static: false}) public element: any; + @ViewChild('elm') public element: any; public myAnimationExp = ''; } diff --git a/packages/core/test/application_ref_spec.ts b/packages/core/test/application_ref_spec.ts index d27a32a60f..4c60a78960 100644 --- a/packages/core/test/application_ref_spec.ts +++ b/packages/core/test/application_ref_spec.ts @@ -417,7 +417,7 @@ class SomeComponent { @Component({template: ''}) class ContainerComp { // TODO(issue/24571): remove '!'. - @ViewChild('vc', {read: ViewContainerRef, static: false}) + @ViewChild('vc', {read: ViewContainerRef}) vc !: ViewContainerRef; } diff --git a/packages/core/test/debug/debug_node_spec.ts b/packages/core/test/debug/debug_node_spec.ts index b772ab6531..8d412d2d31 100644 --- a/packages/core/test/debug/debug_node_spec.ts +++ b/packages/core/test/debug/debug_node_spec.ts @@ -167,7 +167,7 @@ class BankAccount { ` }) class SimpleContentComp { - @ViewChild('content', {static: false}) content !: ElementRef; + @ViewChild('content') content !: ElementRef; } @Component({ diff --git a/packages/core/test/linker/query_integration_spec.ts b/packages/core/test/linker/query_integration_spec.ts index 41378a6245..4870596a4e 100644 --- a/packages/core/test/linker/query_integration_spec.ts +++ b/packages/core/test/linker/query_integration_spec.ts @@ -752,7 +752,7 @@ describe('Query API', () => { class AutoProjecting { // TODO(issue/24571): // remove '!'. - @ContentChild(TemplateRef, {static: false}) + @ContentChild(TemplateRef) content !: TemplateRef; // TODO(issue/24571): @@ -784,7 +784,7 @@ describe('Query API', () => { class AutoProjecting { // TODO(issue/24571): // remove '!'. - @ContentChild(TemplateRef, {static: false}) + @ContentChild(TemplateRef) content !: TemplateRef; // TODO(issue/24571): @@ -839,7 +839,7 @@ class NeedsContentChild implements AfterContentInit, AfterContentChecked { // TODO(issue/24571): remove '!'. _child !: TextDirective; - @ContentChild(TextDirective, {static: false}) + @ContentChild(TextDirective) set child(value) { this._child = value; this.logs.push(['setter', value ? value.text : null]); @@ -856,7 +856,7 @@ class NeedsContentChild implements AfterContentInit, AfterContentChecked { @Directive({selector: '[directive-needs-content-child]'}) class DirectiveNeedsContentChild { // TODO(issue/24571): remove '!'. - @ContentChild(TextDirective, {static: false}) child !: TextDirective; + @ContentChild(TextDirective) child !: TextDirective; } @Component({selector: 'needs-view-child', template: `
`}) @@ -867,7 +867,7 @@ class NeedsViewChild implements AfterViewInit, AfterViewChecked { // TODO(issue/24571): remove '!'. _child !: TextDirective; - @ViewChild(TextDirective, {static: false}) + @ViewChild(TextDirective) set child(value) { this._child = value; this.logs.push(['setter', value ? value.text : null]); @@ -917,13 +917,13 @@ class NeedsQuery { @Component({selector: 'needs-four-queries', template: ''}) class NeedsFourQueries { // TODO(issue/24571): remove '!'. - @ContentChild(TextDirective, {static: false}) query1 !: TextDirective; + @ContentChild(TextDirective) query1 !: TextDirective; // TODO(issue/24571): remove '!'. - @ContentChild(TextDirective, {static: false}) query2 !: TextDirective; + @ContentChild(TextDirective) query2 !: TextDirective; // TODO(issue/24571): remove '!'. - @ContentChild(TextDirective, {static: false}) query3 !: TextDirective; + @ContentChild(TextDirective) query3 !: TextDirective; // TODO(issue/24571): remove '!'. - @ContentChild(TextDirective, {static: false}) query4 !: TextDirective; + @ContentChild(TextDirective) query4 !: TextDirective; } @Component({ @@ -1042,9 +1042,9 @@ class NeedsContentChildrenWithRead { @Component({selector: 'needs-content-child-read', template: ''}) class NeedsContentChildWithRead { // TODO(issue/24571): remove '!'. - @ContentChild('q', {read: TextDirective, static: false}) textDirChild !: TextDirective; + @ContentChild('q', {read: TextDirective}) textDirChild !: TextDirective; // TODO(issue/24571): remove '!'. - @ContentChild('nonExisting', {read: TextDirective, static: false}) + @ContentChild('nonExisting', {read: TextDirective}) nonExistingVar !: TextDirective; } @@ -1089,17 +1089,17 @@ class NeedsViewChildrenWithRead { }) class NeedsViewChildWithRead { // TODO(issue/24571): remove '!'. - @ViewChild('q', {read: TextDirective, static: false}) textDirChild !: TextDirective; + @ViewChild('q', {read: TextDirective}) textDirChild !: TextDirective; // TODO(issue/24571): remove '!'. - @ViewChild('nonExisting', {read: TextDirective, static: false}) nonExistingVar !: TextDirective; + @ViewChild('nonExisting', {read: TextDirective}) nonExistingVar !: TextDirective; } @Component({selector: 'needs-viewcontainer-read', template: '
'}) class NeedsViewContainerWithRead { // TODO(issue/24571): remove '!'. - @ViewChild('q', {read: ViewContainerRef, static: false}) vc !: ViewContainerRef; + @ViewChild('q', {read: ViewContainerRef}) vc !: ViewContainerRef; // TODO(issue/24571): remove '!'. - @ViewChild('nonExisting', {read: ViewContainerRef, static: false}) + @ViewChild('nonExisting', {read: ViewContainerRef}) nonExistingVar !: ViewContainerRef; // TODO(issue/24571): remove '!'. @ContentChild(TemplateRef, {static: true}) template !: TemplateRef; @@ -1128,7 +1128,7 @@ class ManualProjecting { @ContentChild(TemplateRef, {static: true}) template !: TemplateRef; // TODO(issue/24571): remove '!'. - @ViewChild('vc', {read: ViewContainerRef, static: false}) + @ViewChild('vc', {read: ViewContainerRef}) vc !: ViewContainerRef; // TODO(issue/24571): remove '!'. diff --git a/packages/core/test/metadata/di_spec.ts b/packages/core/test/metadata/di_spec.ts index 408f2ac67d..733328e53c 100644 --- a/packages/core/test/metadata/di_spec.ts +++ b/packages/core/test/metadata/di_spec.ts @@ -83,13 +83,13 @@ class Simple { @Component({selector: 'view-child-type-selector', template: ''}) class ViewChildTypeSelectorComponent { // TODO(issue/24571): remove '!'. - @ViewChild(Simple, {static: false}) child !: Simple; + @ViewChild(Simple) child !: Simple; } @Component({selector: 'view-child-string-selector', template: ''}) class ViewChildStringSelectorComponent { // TODO(issue/24571): remove '!'. - @ViewChild('child', {static: false}) child !: ElementRef; + @ViewChild('child') child !: ElementRef; } @Component({selector: 'view-children-type-selector', template: ''}) diff --git a/packages/core/test/render3/ivy/jit_spec.ts b/packages/core/test/render3/ivy/jit_spec.ts index e335e429c5..2f033346b3 100644 --- a/packages/core/test/render3/ivy/jit_spec.ts +++ b/packages/core/test/render3/ivy/jit_spec.ts @@ -297,7 +297,7 @@ ivyEnabled && describe('render3 jit', () => { it('should compile ContentChild query with string predicate on a directive', () => { @Directive({selector: '[test]'}) class TestDirective { - @ContentChild('foo', {static: false}) foo: ElementRef|undefined; + @ContentChild('foo') foo: ElementRef|undefined; } expect((TestDirective as any).ɵdir.contentQueries).not.toBeNull(); @@ -319,7 +319,7 @@ ivyEnabled && describe('render3 jit', () => { @Directive({selector: '[test]'}) class TestDirective { - @ContentChild(SomeDir, {static: false}) dir: SomeDir|undefined; + @ContentChild(SomeDir) dir: SomeDir|undefined; } expect((TestDirective as any).ɵdir.contentQueries).not.toBeNull(); @@ -328,7 +328,7 @@ ivyEnabled && describe('render3 jit', () => { it('should compile ViewChild query on a component', () => { @Component({selector: 'test', template: ''}) class TestComponent { - @ViewChild('foo', {static: false}) foo: ElementRef|undefined; + @ViewChild('foo') foo: ElementRef|undefined; } expect((TestComponent as any).ɵcmp.foo).not.toBeNull(); diff --git a/packages/examples/core/di/ts/contentChild/content_child_example.ts b/packages/examples/core/di/ts/contentChild/content_child_example.ts index ca58b6a23c..f24a611c1f 100644 --- a/packages/examples/core/di/ts/contentChild/content_child_example.ts +++ b/packages/examples/core/di/ts/contentChild/content_child_example.ts @@ -21,7 +21,7 @@ export class Pane { ` }) export class Tab { - @ContentChild(Pane, {static: false}) pane !: Pane; + @ContentChild(Pane) pane !: Pane; } @Component({ diff --git a/packages/examples/core/di/ts/contentChild/content_child_howto.ts b/packages/examples/core/di/ts/contentChild/content_child_howto.ts index 455979bfd0..d062b703f8 100644 --- a/packages/examples/core/di/ts/contentChild/content_child_howto.ts +++ b/packages/examples/core/di/ts/contentChild/content_child_howto.ts @@ -15,7 +15,7 @@ class ChildDirective { @Directive({selector: 'someDir'}) class SomeDir implements AfterContentInit { - @ContentChild(ChildDirective, {static: false}) contentChild !: ChildDirective; + @ContentChild(ChildDirective) contentChild !: ChildDirective; ngAfterContentInit() { // contentChild is set diff --git a/packages/examples/core/di/ts/viewChild/view_child_example.ts b/packages/examples/core/di/ts/viewChild/view_child_example.ts index 49a4fdec86..6601fed8f9 100644 --- a/packages/examples/core/di/ts/viewChild/view_child_example.ts +++ b/packages/examples/core/di/ts/viewChild/view_child_example.ts @@ -26,7 +26,7 @@ export class Pane { `, }) export class ViewChildComp { - @ViewChild(Pane, {static: false}) + @ViewChild(Pane) set pane(v: Pane) { setTimeout(() => { this.selectedPane = v.id; }, 0); } diff --git a/packages/examples/core/di/ts/viewChild/view_child_howto.ts b/packages/examples/core/di/ts/viewChild/view_child_howto.ts index 0547525408..74c906bff6 100644 --- a/packages/examples/core/di/ts/viewChild/view_child_howto.ts +++ b/packages/examples/core/di/ts/viewChild/view_child_howto.ts @@ -15,7 +15,7 @@ class ChildDirective { @Component({selector: 'someCmp', templateUrl: 'someCmp.html'}) class SomeCmp implements AfterViewInit { - @ViewChild(ChildDirective, {static: false}) child !: ChildDirective; + @ViewChild(ChildDirective) child !: ChildDirective; ngAfterViewInit() { // child is set diff --git a/packages/platform-browser/animations/test/animation_renderer_spec.ts b/packages/platform-browser/animations/test/animation_renderer_spec.ts index 8d3e87c82b..6b5b49fa09 100644 --- a/packages/platform-browser/animations/test/animation_renderer_spec.ts +++ b/packages/platform-browser/animations/test/animation_renderer_spec.ts @@ -178,7 +178,7 @@ import {el} from '../../testing/src/browser_util'; }) class Cmp { exp: any; - @ViewChild('elm', {static: false}) public element: any; + @ViewChild('elm') public element: any; } TestBed.configureTestingModule({ @@ -223,11 +223,11 @@ import {el} from '../../testing/src/browser_util'; exp2: any = true; exp3: any = true; - @ViewChild('elm1', {static: false}) public elm1: any; + @ViewChild('elm1') public elm1: any; - @ViewChild('elm2', {static: false}) public elm2: any; + @ViewChild('elm2') public elm2: any; - @ViewChild('elm3', {static: false}) public elm3: any; + @ViewChild('elm3') public elm3: any; } TestBed.configureTestingModule({ diff --git a/packages/platform-browser/animations/test/browser_animation_builder_spec.ts b/packages/platform-browser/animations/test/browser_animation_builder_spec.ts index 72cbfb10cd..38535fcda5 100644 --- a/packages/platform-browser/animations/test/browser_animation_builder_spec.ts +++ b/packages/platform-browser/animations/test/browser_animation_builder_spec.ts @@ -51,7 +51,7 @@ import {el} from '../../testing/src/browser_util'; template: '...', }) class Cmp { - @ViewChild('target', {static: false}) public target: any; + @ViewChild('target') public target: any; constructor(public builder: AnimationBuilder) {}