test: clean up explicit dynamic query usages (#33015)
Cleans up all the places where we explicitly set `static: false` on queries. PR Close #33015
This commit is contained in:
@ -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: '<my-comp [name]="name"></my-comp>'})
|
||||
class MyApp {
|
||||
@ViewChild(MyComponent, {static: false}) comp !: MyComponent;
|
||||
@ViewChild(MyComponent) comp !: MyComponent;
|
||||
name: string = 'Nancy';
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ describe('change detection', () => {
|
||||
template: '<my-comp></my-comp><button id="parent" (click)="noop()"></button>'
|
||||
})
|
||||
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: '<button-parent></button-parent>'})
|
||||
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}} - <my-comp></my-comp>`})
|
||||
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: '<my-comp dir></my-comp>'})
|
||||
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 }}<div dir></div>'})
|
||||
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 }}<div *ngIf="showing" dir></div>'})
|
||||
class MyApp {
|
||||
@ViewChild(Dir, {static: false}) dir !: Dir;
|
||||
@ViewChild(Dir) dir !: Dir;
|
||||
showing = true;
|
||||
name = 'Amelia';
|
||||
}
|
||||
@ -601,7 +601,7 @@ describe('change detection', () => {
|
||||
'<ng-template #foo let-ctx="ctx">{{ ctx.value }}</ng-template><structural-comp [tmp]="foo"></structural-comp>'
|
||||
})
|
||||
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: '<ng-template #foo>Template text</ng-template><structural-comp [tmp]="foo">'
|
||||
})
|
||||
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: '<detached-comp></detached-comp>'})
|
||||
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: '<on-push-comp [value]="value"></on-push-comp>'})
|
||||
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;
|
||||
}
|
||||
|
@ -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) {}
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ describe('di', () => {
|
||||
</div>`
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(StructuralDirective, {static: false}) structuralDir !: StructuralDirective;
|
||||
@ViewChild(StructuralDirective) structuralDir !: StructuralDirective;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule(
|
||||
@ -449,8 +449,8 @@ describe('di', () => {
|
||||
</div>`
|
||||
})
|
||||
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: '<div dirA></div>'})
|
||||
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: '<div dirC></div>'})
|
||||
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: '<div dirB></div><div dirC></div>'})
|
||||
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: '<div dirA dirB="self"></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(DirectiveA, {static: false}) dirA !: DirectiveA;
|
||||
@ViewChild(DirectiveA) dirA !: DirectiveA;
|
||||
}
|
||||
|
||||
@Component({template: '<my-comp dirB="parent"></my-comp>'})
|
||||
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: '<my-comp></my-comp>'})
|
||||
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: '<div dirComp></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(DirectiveComp, {static: false}) dirComp !: DirectiveComp;
|
||||
@ViewChild(DirectiveComp) dirComp !: DirectiveComp;
|
||||
}
|
||||
|
||||
@Component({template: '<my-comp></my-comp>'})
|
||||
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: '<my-comp dirB></my-comp>'})
|
||||
class MyApp {
|
||||
@ViewChild(MyComp, {static: false}) myComp !: MyComp;
|
||||
@ViewChild(MyComp) myComp !: MyComp;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule(
|
||||
@ -779,8 +779,8 @@ describe('di', () => {
|
||||
@Component({template: '<div dirB><div *ngIf="showing" dirA></div></div>'})
|
||||
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: '<div injectorDir otherInjectorDir></div>'})
|
||||
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: '<div injectorDir></div>'})
|
||||
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: '<div dir otherDir></div>'})
|
||||
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: '<ng-template dir></ng-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: `<div id="test-id" dir></div>`,
|
||||
})
|
||||
class ChildComp {
|
||||
@ViewChild(DirectiveA, {static: false}) directive !: DirectiveA;
|
||||
@ViewChild(DirectiveA) directive !: DirectiveA;
|
||||
}
|
||||
|
||||
@Component({
|
||||
@ -1238,8 +1238,8 @@ describe('di', () => {
|
||||
template: '<ng-template dir otherDir #dir="dir" #otherDir="otherDir"></ng-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: '<div optionalDir></div>'})
|
||||
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: '<div dir otherDir #dir="dir" #otherDir="otherDir"></div>'})
|
||||
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: '<my-comp dir otherDir #dir="dir"></my-comp>'})
|
||||
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: '<div dir otherDir #dir="dir"></div>'})
|
||||
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: '<div injectorDir></div>'})
|
||||
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: '<div dir exist="existValue" other="ignore"></div>'})
|
||||
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: '<ng-template dir="initial" exist="existValue" other="ignore"></ng-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: '<ng-container dir="initial" exist="existValue" other="ignore"></ng-container>'
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
@ -1750,7 +1750,7 @@ describe('di', () => {
|
||||
'<div dir style="margin: 1px; color: red;" class="hello there" other-attr="value"></div>'
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
@ -1778,7 +1778,7 @@ describe('di', () => {
|
||||
template: '<div dir exist="existValue" svg:exist="testExistValue" other="otherValue"></div>'
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
@ -1809,7 +1809,7 @@ describe('di', () => {
|
||||
'<div dir exist="existValue" [binding]="bindingValue" (output)="outputValue" other="otherValue" ignore="ignoreValue"></div>'
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
|
@ -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]});
|
||||
|
@ -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<ChildCmp> = null !;
|
||||
@ -314,7 +314,7 @@ describe('host bindings', () => {
|
||||
|
||||
@Component({template: '<span dir></span>'})
|
||||
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: '<div someDir hostBindingDir></div>'})
|
||||
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: '<input hostBindingDir [disabled]="isDisabled">'})
|
||||
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: '<host-binding-comp hostDir></host-binding-comp>'})
|
||||
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: `<host-binding-comp></host-binding-comp>{{ 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: '<host-binding-to-styles></host-binding-to-styles>'})
|
||||
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: '<div hostStyles containerDir></div>'})
|
||||
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></${tag}>`})
|
||||
class App {
|
||||
@ViewChild(UnsafeDir, {static: false}) unsafeDir !: UnsafeDir;
|
||||
@ViewChild(UnsafeDir) unsafeDir !: UnsafeDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, UnsafeDir]});
|
||||
|
@ -243,7 +243,7 @@ describe('acceptance integration tests', () => {
|
||||
|
||||
@Component({template: '<div><ng-container dir></ng-container></div>'})
|
||||
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', () => {
|
||||
'<ng-container dir [contentTpl]="content"><ng-template #content>Content</ng-template></ng-container>'
|
||||
})
|
||||
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: '<ng-container><ng-template dir>Content</ng-template></ng-container>'})
|
||||
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: '<todo></todo>'})
|
||||
class App {
|
||||
@ViewChild(TodoComponentHostBinding, {static: false})
|
||||
@ViewChild(TodoComponentHostBinding)
|
||||
todoComponentHostBinding !: TodoComponentHostBinding;
|
||||
}
|
||||
|
||||
@ -844,7 +844,7 @@ describe('acceptance integration tests', () => {
|
||||
|
||||
@Component({template: '<div hostBindingDir></div>'})
|
||||
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: '<div class="apple orange banana" DirWithClass></div>'})
|
||||
class App {
|
||||
@ViewChild(DirWithClassDirective, {static: false})
|
||||
@ViewChild(DirWithClassDirective)
|
||||
mockClassDirective !: DirWithClassDirective;
|
||||
}
|
||||
|
||||
@ -1071,7 +1071,7 @@ describe('acceptance integration tests', () => {
|
||||
() => {
|
||||
@Component({template: '<div style="width:100px;height:200px" DirWithStyle></div>'})
|
||||
class App {
|
||||
@ViewChild(DirWithStyleDirective, {static: false})
|
||||
@ViewChild(DirWithStyleDirective)
|
||||
mockStyleDirective !: DirWithStyleDirective;
|
||||
}
|
||||
|
||||
@ -1090,7 +1090,7 @@ describe('acceptance integration tests', () => {
|
||||
() => {
|
||||
@Component({template: '<div DirWithClass [class]="value"></div>'})
|
||||
class App {
|
||||
@ViewChild(DirWithClassDirective, {static: false})
|
||||
@ViewChild(DirWithClassDirective)
|
||||
mockClassDirective !: DirWithClassDirective;
|
||||
value = '';
|
||||
}
|
||||
@ -1109,7 +1109,7 @@ describe('acceptance integration tests', () => {
|
||||
() => {
|
||||
@Component({template: '<div DirWithStyle [style]="value"></div>'})
|
||||
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: '<div Dir1WithStyle Dir2WithStyle [style.width]="width"></div>'})
|
||||
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', () => {
|
||||
'<div Dir1WithStyling Dir2WithStyling [style]="stylesExp" [class]="classesExp"></div>'
|
||||
})
|
||||
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 = {};
|
||||
}
|
||||
|
@ -1293,7 +1293,7 @@ describe('onInit', () => {
|
||||
`,
|
||||
})
|
||||
class App {
|
||||
@ViewChild('container', {read: ViewContainerRef, static: false})
|
||||
@ViewChild('container', {read: ViewContainerRef})
|
||||
viewContainerRef !: ViewContainerRef;
|
||||
|
||||
constructor(public compFactoryResolver: ComponentFactoryResolver) {}
|
||||
|
@ -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++; }
|
||||
|
||||
|
@ -43,7 +43,7 @@ describe('outputs', () => {
|
||||
|
||||
@Component({template: '<button-toggle (change)="onChange()"></button-toggle>'})
|
||||
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: '<button-toggle (change)="onChange()" (reset)="onReset()"></button-toggle>'})
|
||||
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: '<button-toggle (change)="counter = counter + 1"></button-toggle>'})
|
||||
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: '<button-toggle *ngIf="condition" (change)="onChange()"></button-toggle>'})
|
||||
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: '<button myButton (click)="onClick()">Click me</button>'})
|
||||
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: '<button-toggle (change)="onChange()" otherDir></button-toggle>'})
|
||||
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', () => {
|
||||
'<button-toggle (change)="onChange()" otherChangeDir [change]="change"></button-toggle>'
|
||||
})
|
||||
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++; }
|
||||
|
@ -70,7 +70,7 @@ describe('pipe', () => {
|
||||
template: `<div my-dir [dirProp]="'a'|double"></div>`,
|
||||
})
|
||||
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;
|
||||
}
|
||||
|
@ -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: '<div #foo></div>'})
|
||||
@ -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: '<ng-content></ng-content>'})
|
||||
@ -538,7 +538,7 @@ describe('query logic', () => {
|
||||
|
||||
@Component({template: '<sub-comp><div #foo></div></sub-comp>'})
|
||||
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: '<sub-comp><div #foo></div></sub-comp>'})
|
||||
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', () => {
|
||||
<ng-template #tpl1 let-idx="idx">
|
||||
<div #foo [id]="'foo1_' + idx"></div>
|
||||
</ng-template>
|
||||
|
||||
|
||||
<div #foo id="middle"></div>
|
||||
|
||||
|
||||
<ng-template #tpl2 let-idx="idx">
|
||||
<div #foo [id]="'foo2_' + idx"></div>
|
||||
</ng-template>
|
||||
|
||||
|
||||
<ng-template vc></ng-template>
|
||||
`,
|
||||
})
|
||||
class TestComponent {
|
||||
@ViewChild(ViewContainerManipulatorDirective, {static: false})
|
||||
@ViewChild(ViewContainerManipulatorDirective)
|
||||
vc !: ViewContainerManipulatorDirective;
|
||||
@ViewChild('tpl1', {static: false}) tpl1 !: TemplateRef<any>;
|
||||
@ViewChild('tpl2', {static: false}) tpl2 !: TemplateRef<any>;
|
||||
@ViewChild('tpl1') tpl1 !: TemplateRef<any>;
|
||||
@ViewChild('tpl2') tpl2 !: TemplateRef<any>;
|
||||
@ViewChildren('foo') query !: QueryList<any>;
|
||||
}
|
||||
|
||||
@ -960,13 +960,13 @@ describe('query logic', () => {
|
||||
</ng-template>
|
||||
|
||||
<ng-template vc #vi0="vc"></ng-template>
|
||||
<ng-template vc #vi1="vc"></ng-template>
|
||||
<ng-template vc #vi1="vc"></ng-template>
|
||||
`,
|
||||
})
|
||||
class TestComponent {
|
||||
@ViewChild('tpl', {static: false}) tpl !: TemplateRef<any>;
|
||||
@ViewChild('vi0', {static: false}) vi0 !: ViewContainerManipulatorDirective;
|
||||
@ViewChild('vi1', {static: false}) vi1 !: ViewContainerManipulatorDirective;
|
||||
@ViewChild('tpl') tpl !: TemplateRef<any>;
|
||||
@ViewChild('vi0') vi0 !: ViewContainerManipulatorDirective;
|
||||
@ViewChild('vi1') vi1 !: ViewContainerManipulatorDirective;
|
||||
@ViewChildren('foo') query !: QueryList<any>;
|
||||
}
|
||||
|
||||
@ -1009,7 +1009,7 @@ describe('query logic', () => {
|
||||
<ng-template #tpl>
|
||||
<span #foo id="from_tpl"></span>
|
||||
</ng-template>
|
||||
|
||||
|
||||
<ng-template [ngTemplateOutlet]="show ? tpl : null"></ng-template>
|
||||
`,
|
||||
})
|
||||
@ -1139,8 +1139,8 @@ function initWithTemplate(compType: Type<any>, template: string) {
|
||||
|
||||
@Component({selector: 'local-ref-query-component', template: '<ng-content></ng-content>'})
|
||||
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<any>;
|
||||
@ContentChildren('contentQuery') contentChildren !: QueryList<any>;
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -753,7 +753,7 @@ describe('styling', () => {
|
||||
template: '<span dir [classesInSchool]="classes" [styleOfClothing]="style"></span>',
|
||||
})
|
||||
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<ChildCmp> = 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<ChildCmp> = null !;
|
||||
|
@ -37,7 +37,7 @@ describe('TemplateRef', () => {
|
||||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(MenuContent, {static: false}) content !: MenuContent;
|
||||
@ViewChild(MenuContent) content !: MenuContent;
|
||||
|
||||
constructor(public viewContainerRef: ViewContainerRef) {}
|
||||
}
|
||||
|
@ -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]'})
|
||||
|
@ -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<any> = null !;
|
||||
|
||||
view0: EmbeddedViewRef<any> = 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<any> = null !;
|
||||
|
||||
view0: EmbeddedViewRef<any> = 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<any> = null !;
|
||||
|
||||
view0: EmbeddedViewRef<any> = null !;
|
||||
|
Reference in New Issue
Block a user