test(core): update core tests (unrelated to queries) to use static flag (#30626)
PR Close #30626
This commit is contained in:
parent
21e8ac1e02
commit
4299ecf9be
|
@ -80,7 +80,7 @@ describe('change detection', () => {
|
|||
})
|
||||
class TestCmpt {
|
||||
counter = 0;
|
||||
@ViewChild('vc', {read: ViewContainerRef}) vcRef !: ViewContainerRef;
|
||||
@ViewChild('vc', {read: ViewContainerRef, static: false}) 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) comp !: MyComponent;
|
||||
@ViewChild(MyComponent, {static: false}) 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) comp !: MyComponent;
|
||||
@ViewChild(MyComponent, {static: false}) comp !: MyComponent;
|
||||
noop() {}
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ describe('change detection', () => {
|
|||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
class ButtonParent implements DoCheck {
|
||||
@ViewChild(MyComponent) comp !: MyComponent;
|
||||
@ViewChild(MyComponent, {static: false}) 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) parent !: ButtonParent;
|
||||
@ViewChild(ButtonParent, {static: false}) 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) myComp !: MyComp;
|
||||
@ViewChild(MyComp, {static: false}) 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) myComp !: MyComp;
|
||||
@ViewChild(Dir) dir !: Dir;
|
||||
@ViewChild(MyComp, {static: false}) myComp !: MyComp;
|
||||
@ViewChild(Dir, {static: false}) 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) myComp !: MyComp;
|
||||
@ViewChild(Dir) dir !: Dir;
|
||||
@ViewChild(MyComp, {static: false}) myComp !: MyComp;
|
||||
@ViewChild(Dir, {static: false}) 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) dir !: Dir;
|
||||
@ViewChild(Dir, {static: false}) dir !: Dir;
|
||||
showing = true;
|
||||
name = 'Amelia';
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ describe('change detection', () => {
|
|||
'<ng-template #foo let-ctx="ctx">{{ ctx.value }}</ng-template><structural-comp [tmp]="foo"></structural-comp>'
|
||||
})
|
||||
class App {
|
||||
@ViewChild(StructuralComp) structuralComp !: StructuralComp;
|
||||
@ViewChild(StructuralComp, {static: false}) structuralComp !: StructuralComp;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, StructuralComp]});
|
||||
|
@ -592,7 +592,7 @@ describe('change detection', () => {
|
|||
template: '<ng-template #foo>Template text</ng-template><structural-comp [tmp]="foo">'
|
||||
})
|
||||
class App {
|
||||
@ViewChild(StructuralComp) structuralComp !: StructuralComp;
|
||||
@ViewChild(StructuralComp, {static: false}) structuralComp !: StructuralComp;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, StructuralComp]});
|
||||
|
@ -623,7 +623,7 @@ describe('change detection', () => {
|
|||
|
||||
@Component({template: '<detached-comp></detached-comp>'})
|
||||
class MyApp {
|
||||
@ViewChild(DetachedComp) comp !: DetachedComp;
|
||||
@ViewChild(DetachedComp, {static: false}) comp !: DetachedComp;
|
||||
|
||||
constructor(public cdr: ChangeDetectorRef) {}
|
||||
}
|
||||
|
@ -734,7 +734,7 @@ describe('change detection', () => {
|
|||
|
||||
@Component({template: '<on-push-comp [value]="value"></on-push-comp>'})
|
||||
class OnPushApp {
|
||||
@ViewChild(OnPushComp) onPushComp !: OnPushComp;
|
||||
@ViewChild(OnPushComp, {static: false}) onPushComp !: OnPushComp;
|
||||
value = '';
|
||||
}
|
||||
|
||||
|
@ -781,7 +781,7 @@ describe('change detection', () => {
|
|||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
class OnPushParent {
|
||||
@ViewChild(OnPushComp) comp !: OnPushComp;
|
||||
@ViewChild(OnPushComp, {static: false}) comp !: OnPushComp;
|
||||
value = 'one';
|
||||
}
|
||||
|
||||
|
@ -843,7 +843,7 @@ describe('change detection', () => {
|
|||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
class EmbeddedViewParent {
|
||||
@ViewChild(OnPushComp) comp !: OnPushComp;
|
||||
@ViewChild(OnPushComp, {static: false}) comp !: OnPushComp;
|
||||
value = 'one';
|
||||
showing = true;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ describe('component', () => {
|
|||
entryComponents: [OtherComponent]
|
||||
})
|
||||
class TestComponent {
|
||||
@ViewChild('vc', {read: ViewContainerRef}) vcref !: ViewContainerRef;
|
||||
@ViewChild('vc', {read: ViewContainerRef, static: true}) vcref !: ViewContainerRef;
|
||||
|
||||
constructor(private _cfr: ComponentFactoryResolver) {}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ describe('projection', () => {
|
|||
@Component(
|
||||
{selector: 'comp', template: `<ng-template><ng-content></ng-content></ng-template>`})
|
||||
class Comp {
|
||||
@ViewChild(TemplateRef) template !: TemplateRef<any>;
|
||||
@ViewChild(TemplateRef, {static: true}) template !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
@Directive({selector: '[trigger]'})
|
||||
|
|
|
@ -377,7 +377,7 @@ describe('di', () => {
|
|||
</div>`
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(StructuralDirective) structuralDir !: StructuralDirective;
|
||||
@ViewChild(StructuralDirective, {static: false}) structuralDir !: StructuralDirective;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule(
|
||||
|
@ -421,8 +421,8 @@ describe('di', () => {
|
|||
</div>`
|
||||
})
|
||||
class MyApp {
|
||||
@ViewChild(HostBindingDirective) hostBindingDir !: HostBindingDirective;
|
||||
@ViewChild(DirectiveA) dirA !: DirectiveA;
|
||||
@ViewChild(HostBindingDirective, {static: false}) hostBindingDir !: HostBindingDirective;
|
||||
@ViewChild(DirectiveA, {static: false}) dirA !: DirectiveA;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule(
|
||||
|
@ -535,7 +535,7 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<div dirA></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(DirectiveA) dirA !: DirectiveA;
|
||||
@ViewChild(DirectiveA, {static: false}) dirA !: DirectiveA;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [DirectiveA, DirectiveB, MyComp]});
|
||||
|
@ -555,7 +555,7 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<div dirC></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(DirectiveC) dirC !: DirectiveC;
|
||||
@ViewChild(DirectiveC, {static: false}) dirC !: DirectiveC;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [DirectiveC, MyComp]});
|
||||
|
@ -575,7 +575,7 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<div dirB></div><div dirC></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(DirectiveC) dirC !: DirectiveC;
|
||||
@ViewChild(DirectiveC, {static: false}) dirC !: DirectiveC;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [DirectiveB, DirectiveC, MyComp]});
|
||||
|
@ -596,12 +596,12 @@ describe('di', () => {
|
|||
|
||||
@Component({selector: 'my-comp', template: '<div dirA dirB="self"></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(DirectiveA) dirA !: DirectiveA;
|
||||
@ViewChild(DirectiveA, {static: false}) dirA !: DirectiveA;
|
||||
}
|
||||
|
||||
@Component({template: '<my-comp dirB="parent"></my-comp>'})
|
||||
class MyApp {
|
||||
@ViewChild(MyComp) myComp !: MyComp;
|
||||
@ViewChild(MyComp, {static: false}) myComp !: MyComp;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [DirectiveA, DirectiveB, MyComp, MyApp]});
|
||||
|
@ -646,12 +646,12 @@ describe('di', () => {
|
|||
viewProviders: [{provide: String, useValue: 'Foo'}]
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(DirectiveString) dirString !: DirectiveString;
|
||||
@ViewChild(DirectiveString, {static: false}) dirString !: DirectiveString;
|
||||
}
|
||||
|
||||
@Component({template: '<my-comp></my-comp>'})
|
||||
class MyApp {
|
||||
@ViewChild(MyComp) myComp !: MyComp;
|
||||
@ViewChild(MyComp, {static: false}) myComp !: MyComp;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [DirectiveString, MyComp, MyApp]});
|
||||
|
@ -670,12 +670,12 @@ describe('di', () => {
|
|||
|
||||
@Component({selector: 'my-comp', template: '<div dirComp></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(DirectiveComp) dirComp !: DirectiveComp;
|
||||
@ViewChild(DirectiveComp, {static: false}) dirComp !: DirectiveComp;
|
||||
}
|
||||
|
||||
@Component({template: '<my-comp></my-comp>'})
|
||||
class MyApp {
|
||||
@ViewChild(MyComp) myComp !: MyComp;
|
||||
@ViewChild(MyComp, {static: false}) myComp !: MyComp;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [DirectiveComp, MyComp, MyApp]});
|
||||
|
@ -734,7 +734,7 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<my-comp dirB></my-comp>'})
|
||||
class MyApp {
|
||||
@ViewChild(MyComp) myComp !: MyComp;
|
||||
@ViewChild(MyComp, {static: false}) myComp !: MyComp;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule(
|
||||
|
@ -751,8 +751,8 @@ describe('di', () => {
|
|||
@Component({template: '<div dirB><div *ngIf="showing" dirA></div></div>'})
|
||||
class MyApp {
|
||||
showing = false;
|
||||
@ViewChild(DirectiveA) dirA !: DirectiveA;
|
||||
@ViewChild(DirectiveB) dirB !: DirectiveB;
|
||||
@ViewChild(DirectiveA, {static: false}) dirA !: DirectiveA;
|
||||
@ViewChild(DirectiveB, {static: false}) dirB !: DirectiveB;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [DirectiveA, DirectiveB, MyApp]});
|
||||
|
@ -952,8 +952,8 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<div injectorDir otherInjectorDir></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(InjectorDir) injectorDir !: InjectorDir;
|
||||
@ViewChild(OtherInjectorDir) otherInjectorDir !: OtherInjectorDir;
|
||||
@ViewChild(InjectorDir, {static: false}) injectorDir !: InjectorDir;
|
||||
@ViewChild(OtherInjectorDir, {static: false}) otherInjectorDir !: OtherInjectorDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [InjectorDir, OtherInjectorDir, MyComp]});
|
||||
|
@ -978,7 +978,7 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<div injectorDir></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(InjectorDir) injectorDir !: InjectorDir;
|
||||
@ViewChild(InjectorDir, {static: false}) injectorDir !: InjectorDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [InjectorDir, MyComp]});
|
||||
|
@ -1015,8 +1015,8 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<div dir otherDir></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir) otherDirective !: MyOtherDir;
|
||||
@ViewChild(MyDir, {static: false}) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyOtherDir, MyComp]});
|
||||
|
@ -1047,7 +1047,7 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<ng-template dir></ng-template>'})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directive !: MyDir;
|
||||
@ViewChild(MyDir, {static: false}) directive !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
|
@ -1085,8 +1085,8 @@ describe('di', () => {
|
|||
template: '<ng-template dir otherDir #dir="dir" #otherDir="otherDir"></ng-template>'
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir) otherDirective !: MyOtherDir;
|
||||
@ViewChild(MyDir, {static: false}) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyOtherDir, MyComp]});
|
||||
|
@ -1129,7 +1129,7 @@ describe('di', () => {
|
|||
}
|
||||
@Component({template: '<div optionalDir></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(OptionalDir) directive !: OptionalDir;
|
||||
@ViewChild(OptionalDir, {static: false}) directive !: OptionalDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [OptionalDir, MyComp]});
|
||||
|
@ -1158,8 +1158,8 @@ describe('di', () => {
|
|||
}
|
||||
@Component({template: '<div dir otherDir #dir="dir" #otherDir="otherDir"></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir) otherDirective !: MyOtherDir;
|
||||
@ViewChild(MyDir, {static: false}) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyOtherDir, MyComp]});
|
||||
|
@ -1224,9 +1224,9 @@ describe('di', () => {
|
|||
() => {
|
||||
@Component({selector: 'my-app', template: '<my-comp dir otherDir #dir="dir"></my-comp>'})
|
||||
class MyApp {
|
||||
@ViewChild(MyComp) component !: MyComp;
|
||||
@ViewChild(MyDir) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir) otherDirective !: MyOtherDir;
|
||||
@ViewChild(MyComp, {static: false}) component !: MyComp;
|
||||
@ViewChild(MyDir, {static: false}) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir;
|
||||
}
|
||||
TestBed.configureTestingModule({declarations: [MyApp, MyComp, MyDir, MyOtherDir]});
|
||||
const fixture = TestBed.createComponent(MyApp);
|
||||
|
@ -1247,8 +1247,8 @@ describe('di', () => {
|
|||
@Component({selector: 'my-comp', template: '<div dir otherDir #dir="dir"></div>'})
|
||||
class MyComp {
|
||||
constructor(public cdr: ChangeDetectorRef) {}
|
||||
@ViewChild(MyDir) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir) otherDirective !: MyOtherDir;
|
||||
@ViewChild(MyDir, {static: false}) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir;
|
||||
}
|
||||
TestBed.configureTestingModule({declarations: [MyComp, MyDir, MyOtherDir]});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
|
@ -1274,9 +1274,9 @@ describe('di', () => {
|
|||
})
|
||||
class MyApp {
|
||||
constructor(public cdr: ChangeDetectorRef) {}
|
||||
@ViewChild(MyComp) component !: MyComp;
|
||||
@ViewChild(MyDir) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir) otherDirective !: MyOtherDir;
|
||||
@ViewChild(MyComp, {static: false}) component !: MyComp;
|
||||
@ViewChild(MyDir, {static: false}) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir;
|
||||
}
|
||||
TestBed.configureTestingModule({declarations: [MyApp, MyComp, MyDir, MyOtherDir]});
|
||||
const fixture = TestBed.createComponent(MyApp);
|
||||
|
@ -1302,8 +1302,8 @@ describe('di', () => {
|
|||
class MyComp {
|
||||
showing = true;
|
||||
constructor(public cdr: ChangeDetectorRef) {}
|
||||
@ViewChild(MyDir) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir) otherDirective !: MyOtherDir;
|
||||
@ViewChild(MyDir, {static: false}) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyComp, MyDir, MyOtherDir]});
|
||||
|
@ -1325,8 +1325,8 @@ describe('di', () => {
|
|||
class MyComp {
|
||||
showing = true;
|
||||
constructor(public cdr: ChangeDetectorRef) {}
|
||||
@ViewChild(MyDir) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir) otherDirective !: MyOtherDir;
|
||||
@ViewChild(MyDir, {static: false}) directive !: MyDir;
|
||||
@ViewChild(MyOtherDir, {static: false}) otherDirective !: MyOtherDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyComp, MyDir, MyOtherDir]});
|
||||
|
@ -1375,7 +1375,7 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<div injectorDir></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(InjectorDir) injectorDirInstance !: InjectorDir;
|
||||
@ViewChild(InjectorDir, {static: false}) injectorDirInstance !: InjectorDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [InjectorDir, MyComp]});
|
||||
|
@ -1468,7 +1468,7 @@ describe('di', () => {
|
|||
providers: [{provide: LOCALE_ID, useValue: 'en-GB'}]
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) myDir !: MyDir;
|
||||
@ViewChild(MyDir, {static: false}) myDir !: MyDir;
|
||||
constructor(@Inject(LOCALE_ID) public localeId: string) {}
|
||||
}
|
||||
|
||||
|
@ -1490,7 +1490,7 @@ describe('di', () => {
|
|||
|
||||
@Component({template: '<div dir exist="existValue" other="ignore"></div>'})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
|
@ -1514,7 +1514,7 @@ describe('di', () => {
|
|||
@Component(
|
||||
{template: '<ng-template dir="initial" exist="existValue" other="ignore"></ng-template>'})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
|
@ -1539,7 +1539,7 @@ describe('di', () => {
|
|||
template: '<ng-container dir="initial" exist="existValue" other="ignore"></ng-container>'
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
|
@ -1566,7 +1566,7 @@ describe('di', () => {
|
|||
'<div dir style="margin: 1px; color: red;" class="hello there" other-attr="value"></div>'
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
|
@ -1593,7 +1593,7 @@ describe('di', () => {
|
|||
template: '<div dir exist="existValue" svg:exist="testExistValue" other="otherValue"></div>'
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
|
@ -1624,7 +1624,7 @@ describe('di', () => {
|
|||
'<div dir exist="existValue" [binding]="bindingValue" (output)="outputValue" other="otherValue" ignore="ignoreValue"></div>'
|
||||
})
|
||||
class MyComp {
|
||||
@ViewChild(MyDir) directiveInstance !: MyDir;
|
||||
@ViewChild(MyDir, {static: false}) directiveInstance !: MyDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
|
|
|
@ -213,7 +213,7 @@ describe('directives', () => {
|
|||
it('should allow outputs of directive on ng-template', () => {
|
||||
@Component({template: `<ng-template (out)="value = true"></ng-template>`})
|
||||
class TestComp {
|
||||
@ViewChild(TestDir) testDir: TestDir|undefined;
|
||||
@ViewChild(TestDir, {static: true}) testDir: TestDir|undefined;
|
||||
value = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -312,9 +312,9 @@ onlyInIvy('Ivy-specific utilities').describe('discovery utils deprecated', () =>
|
|||
`
|
||||
})
|
||||
class Comp {
|
||||
@ViewChild(MyDir1) myDir1Instance !: MyDir1;
|
||||
@ViewChild(MyDir2) myDir2Instance !: MyDir2;
|
||||
@ViewChild(MyDir3) myDir3Instance !: MyDir3;
|
||||
@ViewChild(MyDir1, {static: false}) myDir1Instance !: MyDir1;
|
||||
@ViewChild(MyDir2, {static: false}) myDir2Instance !: MyDir2;
|
||||
@ViewChild(MyDir3, {static: false}) myDir3Instance !: MyDir3;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Comp, MyDir1, MyDir2, MyDir3]});
|
||||
|
|
|
@ -121,7 +121,7 @@ describe('host bindings', () => {
|
|||
class ParentCmp {
|
||||
private _prop = '';
|
||||
|
||||
@ViewChild('template', {read: ViewContainerRef})
|
||||
@ViewChild('template', {read: ViewContainerRef, static: false})
|
||||
vcr: ViewContainerRef = null !;
|
||||
|
||||
private child: ComponentRef<ChildCmp> = null !;
|
||||
|
@ -314,7 +314,7 @@ describe('host bindings', () => {
|
|||
|
||||
@Component({template: '<span dir></span>'})
|
||||
class App {
|
||||
@ViewChild(Dir) directiveInstance !: Dir;
|
||||
@ViewChild(Dir, {static: false}) directiveInstance !: Dir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, Dir]});
|
||||
|
@ -403,7 +403,7 @@ describe('host bindings', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(HostBindingDir) hostBindingDir !: HostBindingDir;
|
||||
@ViewChild(HostBindingDir, {static: false}) 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) hostBindingDir !: HostBindingDir;
|
||||
@ViewChild(HostBindingDir, {static: false}) 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) hostBindingInputDir !: HostBindingInputDir;
|
||||
@ViewChild(HostBindingInputDir, {static: false}) hostBindingInputDir !: HostBindingInputDir;
|
||||
isDisabled = true;
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ describe('host bindings', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(NameComp) nameComp !: NameComp;
|
||||
@ViewChild(NameComp, {static: false}) nameComp !: NameComp;
|
||||
name = '';
|
||||
}
|
||||
|
||||
|
@ -685,8 +685,8 @@ describe('host bindings', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(HostBindingComp) hostBindingComp !: HostBindingComp;
|
||||
@ViewChild(NameComp) nameComp !: NameComp;
|
||||
@ViewChild(HostBindingComp, {static: false}) hostBindingComp !: HostBindingComp;
|
||||
@ViewChild(NameComp, {static: false}) nameComp !: NameComp;
|
||||
name = '';
|
||||
otherName = '';
|
||||
}
|
||||
|
@ -760,8 +760,8 @@ describe('host bindings', () => {
|
|||
|
||||
@Component({template: '<host-binding-comp hostDir></host-binding-comp>'})
|
||||
class App {
|
||||
@ViewChild(HostBindingComp) hostBindingComp !: HostBindingComp;
|
||||
@ViewChild(HostBindingDir) hostBindingDir !: HostBindingDir;
|
||||
@ViewChild(HostBindingComp, {static: false}) hostBindingComp !: HostBindingComp;
|
||||
@ViewChild(HostBindingDir, {static: false}) 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) hostBindingComp !: HostBindingComp;
|
||||
@ViewChild(HostBindingComp, {static: false}) hostBindingComp !: HostBindingComp;
|
||||
name = '';
|
||||
}
|
||||
|
||||
|
@ -849,8 +849,8 @@ describe('host bindings', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(SubDirective) subDir !: SubDirective;
|
||||
@ViewChild(SuperDirective) superDir !: SuperDirective;
|
||||
@ViewChild(SubDirective, {static: false}) subDir !: SubDirective;
|
||||
@ViewChild(SuperDirective, {static: false}) 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) hostBindingDir !: HostBindingToStyles;
|
||||
@ViewChild(HostBindingToStyles, {static: false}) hostBindingDir !: HostBindingToStyles;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, HostBindingToStyles]});
|
||||
|
@ -987,7 +987,7 @@ describe('host bindings', () => {
|
|||
|
||||
@Component({template: '<div hostStyles containerDir></div>'})
|
||||
class App {
|
||||
@ViewChild(HostBindingToStyles) hostBindingDir !: HostBindingToStyles;
|
||||
@ViewChild(HostBindingToStyles, {static: false}) hostBindingDir !: HostBindingToStyles;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, HostBindingToStyles, ContainerDir]});
|
||||
|
@ -1037,7 +1037,7 @@ describe('host bindings', () => {
|
|||
|
||||
@Component({template: `<${tag} unsafeUrlHostBindingDir></${tag}>`})
|
||||
class App {
|
||||
@ViewChild(UnsafeDir) unsafeDir !: UnsafeDir;
|
||||
@ViewChild(UnsafeDir, {static: false}) unsafeDir !: UnsafeDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, UnsafeDir]});
|
||||
|
|
|
@ -896,10 +896,10 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
|
|||
@Component({selector: 'div-query', template: '<ng-container #vc></ng-container>'})
|
||||
class DivQuery {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ContentChild(TemplateRef) template !: TemplateRef<any>;
|
||||
@ContentChild(TemplateRef, {static: true}) template !: TemplateRef<any>;
|
||||
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ViewChild('vc', {read: ViewContainerRef})
|
||||
@ViewChild('vc', {read: ViewContainerRef, static: true})
|
||||
vc !: ViewContainerRef;
|
||||
|
||||
// TODO(issue/24571): remove '!'.
|
||||
|
|
|
@ -143,7 +143,7 @@ describe('acceptance integration tests', () => {
|
|||
template: '<ng-template testDirective><ng-container>content</ng-container></ng-template>'
|
||||
})
|
||||
class App {
|
||||
@ViewChild(TestDirective) testDirective !: TestDirective;
|
||||
@ViewChild(TestDirective, {static: true}) testDirective !: TestDirective;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, TestDirective]});
|
||||
|
@ -213,7 +213,7 @@ describe('acceptance integration tests', () => {
|
|||
'<ng-template testDirective><ng-container><ng-container><ng-container>content</ng-container></ng-container></ng-container></ng-template>'
|
||||
})
|
||||
class App {
|
||||
@ViewChild(TestDirective) testDirective !: TestDirective;
|
||||
@ViewChild(TestDirective, {static: true}) testDirective !: TestDirective;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, TestDirective]});
|
||||
|
@ -243,7 +243,7 @@ describe('acceptance integration tests', () => {
|
|||
|
||||
@Component({template: '<div><ng-container dir></ng-container></div>'})
|
||||
class App {
|
||||
@ViewChild(TestDirective) testDirective !: TestDirective;
|
||||
@ViewChild(TestDirective, {static: false}) 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) testDirective !: TestDirective;
|
||||
@ViewChild(TestDirective, {static: false}) 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) testDirective !: TestDirective;
|
||||
@ViewChild(TestDirective, {static: false}) testDirective !: TestDirective;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, TestDirective]});
|
||||
|
@ -608,7 +608,8 @@ describe('acceptance integration tests', () => {
|
|||
|
||||
@Component({template: '<todo></todo>'})
|
||||
class App {
|
||||
@ViewChild(TodoComponentHostBinding) todoComponentHostBinding !: TodoComponentHostBinding;
|
||||
@ViewChild(TodoComponentHostBinding, {static: false})
|
||||
todoComponentHostBinding !: TodoComponentHostBinding;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, TodoComponentHostBinding]});
|
||||
|
@ -843,7 +844,7 @@ describe('acceptance integration tests', () => {
|
|||
|
||||
@Component({template: '<div hostBindingDir></div>'})
|
||||
class App {
|
||||
@ViewChild(HostBindingDir) hostBindingDir !: HostBindingDir;
|
||||
@ViewChild(HostBindingDir, {static: false}) hostBindingDir !: HostBindingDir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, HostBindingDir]});
|
||||
|
@ -1011,7 +1012,7 @@ describe('acceptance integration tests', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(StructuralComp) structuralComp !: StructuralComp;
|
||||
@ViewChild(StructuralComp, {static: false}) structuralComp !: StructuralComp;
|
||||
value: any;
|
||||
}
|
||||
|
||||
|
@ -1052,7 +1053,8 @@ describe('acceptance integration tests', () => {
|
|||
() => {
|
||||
@Component({template: '<div class="apple orange banana" DirWithClass></div>'})
|
||||
class App {
|
||||
@ViewChild(DirWithClassDirective) mockClassDirective !: DirWithClassDirective;
|
||||
@ViewChild(DirWithClassDirective, {static: false})
|
||||
mockClassDirective !: DirWithClassDirective;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, DirWithClassDirective]});
|
||||
|
@ -1067,7 +1069,8 @@ describe('acceptance integration tests', () => {
|
|||
() => {
|
||||
@Component({template: '<div style="width:100px;height:200px" DirWithStyle></div>'})
|
||||
class App {
|
||||
@ViewChild(DirWithStyleDirective) mockStyleDirective !: DirWithStyleDirective;
|
||||
@ViewChild(DirWithStyleDirective, {static: false})
|
||||
mockStyleDirective !: DirWithStyleDirective;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, DirWithStyleDirective]});
|
||||
|
@ -1085,7 +1088,8 @@ describe('acceptance integration tests', () => {
|
|||
() => {
|
||||
@Component({template: '<div DirWithClass [class]="value"></div>'})
|
||||
class App {
|
||||
@ViewChild(DirWithClassDirective) mockClassDirective !: DirWithClassDirective;
|
||||
@ViewChild(DirWithClassDirective, {static: false})
|
||||
mockClassDirective !: DirWithClassDirective;
|
||||
value = '';
|
||||
}
|
||||
|
||||
|
@ -1103,7 +1107,8 @@ describe('acceptance integration tests', () => {
|
|||
() => {
|
||||
@Component({template: '<div DirWithStyle [style]="value"></div>'})
|
||||
class App {
|
||||
@ViewChild(DirWithStyleDirective) mockStyleDirective !: DirWithStyleDirective;
|
||||
@ViewChild(DirWithStyleDirective, {static: false})
|
||||
mockStyleDirective !: DirWithStyleDirective;
|
||||
value !: {[key: string]: string};
|
||||
}
|
||||
|
||||
|
@ -1179,7 +1184,7 @@ describe('acceptance integration tests', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(DirWithSingleStylingBindings)
|
||||
@ViewChild(DirWithSingleStylingBindings, {static: false})
|
||||
dirInstance !: DirWithSingleStylingBindings;
|
||||
}
|
||||
|
||||
|
@ -1235,8 +1240,8 @@ describe('acceptance integration tests', () => {
|
|||
@Component(
|
||||
{template: '<div Dir1WithStyle Dir2WithStyle [style.width]="width"></div>'})
|
||||
class App {
|
||||
@ViewChild(Dir1WithStyle) dir1Instance !: Dir1WithStyle;
|
||||
@ViewChild(Dir2WithStyle) dir2Instance !: Dir2WithStyle;
|
||||
@ViewChild(Dir1WithStyle, {static: false}) dir1Instance !: Dir1WithStyle;
|
||||
@ViewChild(Dir2WithStyle, {static: false}) dir2Instance !: Dir2WithStyle;
|
||||
width: string|null = null;
|
||||
}
|
||||
|
||||
|
@ -1300,8 +1305,8 @@ describe('acceptance integration tests', () => {
|
|||
'<div Dir1WithStyling Dir2WithStyling [style]="stylesExp" [class]="classesExp"></div>'
|
||||
})
|
||||
class App {
|
||||
@ViewChild(Dir1WithStyling) dir1Instance !: Dir1WithStyling;
|
||||
@ViewChild(Dir2WithStyling) dir2Instance !: Dir2WithStyling;
|
||||
@ViewChild(Dir1WithStyling, {static: false}) dir1Instance !: Dir1WithStyling;
|
||||
@ViewChild(Dir2WithStyling, {static: false}) dir2Instance !: Dir2WithStyling;
|
||||
stylesExp: any = {};
|
||||
classesExp: any = {};
|
||||
}
|
||||
|
@ -1491,7 +1496,7 @@ describe('acceptance integration tests', () => {
|
|||
@Component(
|
||||
{selector: 'test-component', template: `foo`, host: {'[attr.aria-disabled]': 'true'}})
|
||||
class TestComponent {
|
||||
@ContentChild(TemplateRef) tpl !: TemplateRef<any>;
|
||||
@ContentChild(TemplateRef, {static: true}) tpl !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [TestComponent]});
|
||||
|
|
|
@ -1293,7 +1293,7 @@ describe('onInit', () => {
|
|||
`,
|
||||
})
|
||||
class App {
|
||||
@ViewChild('container', {read: ViewContainerRef})
|
||||
@ViewChild('container', {read: ViewContainerRef, static: false})
|
||||
viewContainerRef !: ViewContainerRef;
|
||||
|
||||
constructor(public compFactoryResolver: ComponentFactoryResolver) {}
|
||||
|
|
|
@ -220,7 +220,7 @@ describe('event listeners', () => {
|
|||
count = 0;
|
||||
someValue = -1;
|
||||
|
||||
@ViewChild(FooDirective) fooDirective: FooDirective|null = null;
|
||||
@ViewChild(FooDirective, {static: false}) 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) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(ButtonToggle, {static: false}) 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) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(ButtonToggle, {static: false}) 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) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(ButtonToggle, {static: false}) 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) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle;
|
||||
condition = true;
|
||||
|
||||
onChange() { counter++; }
|
||||
|
@ -133,7 +133,7 @@ describe('outputs', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(ButtonToggle) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle;
|
||||
condition = true;
|
||||
condition2 = true;
|
||||
|
||||
|
@ -168,8 +168,8 @@ describe('outputs', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(ButtonToggle) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(DestroyComp) destroyComp !: DestroyComp;
|
||||
@ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(DestroyComp, {static: false}) 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) buttonDir !: MyButton;
|
||||
@ViewChild(MyButton, {static: false}) 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) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(OtherDir) otherDir !: OtherDir;
|
||||
@ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(OtherDir, {static: false}) 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) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(OtherChangeDir) otherDir !: OtherChangeDir;
|
||||
@ViewChild(ButtonToggle, {static: false}) buttonToggle !: ButtonToggle;
|
||||
@ViewChild(OtherChangeDir, {static: false}) otherDir !: OtherChangeDir;
|
||||
change = true;
|
||||
|
||||
onChange() { counter++; }
|
||||
|
|
|
@ -70,7 +70,7 @@ describe('pipe', () => {
|
|||
template: `<div my-dir [dirProp]="'a'|double"></div>`,
|
||||
})
|
||||
class App {
|
||||
@ViewChild(Dir) directive !: Dir;
|
||||
@ViewChild(Dir, {static: false}) directive !: Dir;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [App, DoublePipe, Dir]});
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('TemplateRef', () => {
|
|||
exportAs: 'menuContent'
|
||||
})
|
||||
class MenuContent {
|
||||
@ViewChild(TemplateRef) template !: TemplateRef<any>;
|
||||
@ViewChild(TemplateRef, {static: true}) template !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -37,7 +37,7 @@ describe('TemplateRef', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild(MenuContent) content !: MenuContent;
|
||||
@ViewChild(MenuContent, {static: false}) content !: MenuContent;
|
||||
|
||||
constructor(public viewContainerRef: ViewContainerRef) {}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ describe('TemplateRef', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild('templateRef')
|
||||
@ViewChild('templateRef', {static: true})
|
||||
templateRef !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ describe('TemplateRef', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild('templateRef')
|
||||
@ViewChild('templateRef', {static: true})
|
||||
templateRef !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ describe('TemplateRef', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild('templateRef')
|
||||
@ViewChild('templateRef', {static: true})
|
||||
templateRef !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ describe('TemplateRef', () => {
|
|||
`
|
||||
})
|
||||
class App {
|
||||
@ViewChild('templateRef')
|
||||
@ViewChild('templateRef', {static: true})
|
||||
templateRef !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
|
|
|
@ -1770,7 +1770,7 @@ class ViewContainerRefComp {
|
|||
`
|
||||
})
|
||||
class ViewContainerRefApp {
|
||||
@ViewChild(ViewContainerRefComp) vcrComp !: ViewContainerRefComp;
|
||||
@ViewChild(ViewContainerRefComp, {static: false}) vcrComp !: ViewContainerRefComp;
|
||||
}
|
||||
|
||||
@Directive({selector: '[structDir]'})
|
||||
|
@ -1803,7 +1803,7 @@ class ConstructorDir {
|
|||
`
|
||||
})
|
||||
class ConstructorApp {
|
||||
@ViewChild('foo') foo !: ElementRef;
|
||||
@ViewChild('foo', {static: true}) foo !: ElementRef;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -1815,5 +1815,5 @@ class ConstructorApp {
|
|||
`
|
||||
})
|
||||
class ConstructorAppWithQueries {
|
||||
@ViewChild('foo') foo !: TemplateRef<any>;
|
||||
@ViewChild('foo', {static: true}) foo !: TemplateRef<any>;
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
]
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('element')
|
||||
@ViewChild('element', {static: false})
|
||||
element: any;
|
||||
exp: any = '';
|
||||
}
|
||||
|
@ -1433,7 +1433,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
])]
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('green') public element: any;
|
||||
@ViewChild('green', {static: false}) public element: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -1770,7 +1770,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
class Cmp {
|
||||
public exp: any;
|
||||
|
||||
@ViewChild('parent') public parentElement: any;
|
||||
@ViewChild('parent', {static: false}) public parentElement: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -1824,9 +1824,9 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
public exp1: any;
|
||||
public exp2: any;
|
||||
|
||||
@ViewChild('parent') public parent: any;
|
||||
@ViewChild('parent', {static: false}) public parent: any;
|
||||
|
||||
@ViewChild('child') public child: any;
|
||||
@ViewChild('child', {static: false}) public child: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -1881,11 +1881,11 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
public exp1: any;
|
||||
public exp2: any;
|
||||
|
||||
@ViewChild('parent') public parent: any;
|
||||
@ViewChild('parent', {static: false}) public parent: any;
|
||||
|
||||
@ViewChild('child1') public child1Elm: any;
|
||||
@ViewChild('child1', {static: false}) public child1Elm: any;
|
||||
|
||||
@ViewChild('child2') public child2Elm: any;
|
||||
@ViewChild('child2', {static: false}) public child2Elm: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -2240,7 +2240,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
[transition(':enter', [style({opacity: 0}), animate('1s', style({opacity: 1}))])])]
|
||||
})
|
||||
class OuterCmp {
|
||||
@ViewChild('inner') public inner: any;
|
||||
@ViewChild('inner', {static: false}) public inner: any;
|
||||
public exp: any = null;
|
||||
|
||||
update() { this.exp = 'go'; }
|
||||
|
@ -3073,7 +3073,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
exp: any = false;
|
||||
disableExp = false;
|
||||
|
||||
@ViewChild('elm') public element: any;
|
||||
@ViewChild('elm', {static: true}) public element: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -3231,7 +3231,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
]
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('parent') public parentElm: any;
|
||||
@ViewChild('parent', {static: false}) public parentElm: any;
|
||||
disableExp = false;
|
||||
exp = false;
|
||||
}
|
||||
|
@ -3322,7 +3322,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
`
|
||||
})
|
||||
class ParentCmp {
|
||||
@ViewChild('child') public child: ChildCmp|null = null;
|
||||
@ViewChild('child', {static: false}) public child: ChildCmp|null = null;
|
||||
disableExp = false;
|
||||
}
|
||||
|
||||
|
@ -3438,7 +3438,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
`
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('container') public container: any;
|
||||
@ViewChild('container', {static: false}) public container: any;
|
||||
|
||||
disableExp = false;
|
||||
exp = '';
|
||||
|
@ -3661,7 +3661,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
});
|
||||
|
||||
modifiedInIvy('FW-952 - Error recovery is handled differently in Ivy than VE')
|
||||
.it('should continue to clean up DOM-related animation artificats even if a compiler-level error is thrown midway',
|
||||
.it('should continue to clean up DOM-related animation artifacts even if a compiler-level error is thrown midway',
|
||||
() => {
|
||||
@Component({
|
||||
selector: 'if-cmp',
|
||||
|
@ -3684,7 +3684,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
class Cmp {
|
||||
exp: any = false;
|
||||
|
||||
@ViewChild('contents') public contents: any;
|
||||
@ViewChild('contents', {static: true}) public contents: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
|
|
@ -14,7 +14,6 @@ import {CommonModule} from '@angular/common';
|
|||
import {Component, HostBinding, ViewChild} from '@angular/core';
|
||||
import {TestBed, fakeAsync, flushMicrotasks} from '@angular/core/testing';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {ivyEnabled} from '@angular/private/testing';
|
||||
|
||||
import {HostListener} from '../../src/metadata/directives';
|
||||
|
||||
|
@ -888,7 +887,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
]
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('container') public container: any;
|
||||
@ViewChild('container', {static: false}) public container: any;
|
||||
public items: any[] = [];
|
||||
}
|
||||
|
||||
|
@ -1202,9 +1201,9 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
public exp1: any = '';
|
||||
public exp2: any = true;
|
||||
|
||||
@ViewChild('ancestor') public ancestorElm: any;
|
||||
@ViewChild('ancestor', {static: false}) public ancestorElm: any;
|
||||
|
||||
@ViewChild('parent') public parentElm: any;
|
||||
@ViewChild('parent', {static: false}) public parentElm: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -1281,9 +1280,9 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
public exp2: any = '';
|
||||
public parentExp: any = true;
|
||||
|
||||
@ViewChild('ancestor') public ancestorElm: any;
|
||||
@ViewChild('ancestor', {static: false}) public ancestorElm: any;
|
||||
|
||||
@ViewChild('parent') public parentElm: any;
|
||||
@ViewChild('parent', {static: false}) public parentElm: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -1637,7 +1636,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
class ParentCmp {
|
||||
public exp: any;
|
||||
|
||||
@ViewChild('child') public child: any;
|
||||
@ViewChild('child', {static: false}) public child: any;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -1686,7 +1685,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
class ParentCmp {
|
||||
public exp: any;
|
||||
|
||||
@ViewChild('child') public child: any;
|
||||
@ViewChild('child', {static: true}) public child: any;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -1705,10 +1704,6 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
// In Ivy, change detection needs to run before the ViewQuery for cmp.child will resolve.
|
||||
// Keeping this test enabled since we still want to test the animation logic in Ivy.
|
||||
if (ivyEnabled) fixture.detectChanges();
|
||||
|
||||
cmp.child.items = [4, 5, 6];
|
||||
fixture.detectChanges();
|
||||
|
||||
|
@ -1853,9 +1848,9 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
public exp1: any;
|
||||
public exp2: any;
|
||||
|
||||
@ViewChild('parent') public elm1: any;
|
||||
@ViewChild('parent', {static: false}) public elm1: any;
|
||||
|
||||
@ViewChild('child') public elm2: any;
|
||||
@ViewChild('child', {static: false}) public elm2: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -1915,7 +1910,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
public exp: any;
|
||||
public items: any[] = [0, 1, 2, 3, 4];
|
||||
|
||||
@ViewChild('parent') public elm: any;
|
||||
@ViewChild('parent', {static: false}) public elm: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -1985,7 +1980,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
public exp: any;
|
||||
public items: any[] = [0, 1, 2, 3, 4];
|
||||
|
||||
@ViewChild('parent') public elm: any;
|
||||
@ViewChild('parent', {static: false}) public elm: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -2038,7 +2033,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
public exp1: any;
|
||||
public exp2: any;
|
||||
|
||||
@ViewChild('parent') public elm: any;
|
||||
@ViewChild('parent', {static: false}) public elm: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -2108,7 +2103,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
public exp1: any;
|
||||
public exp2: any;
|
||||
|
||||
@ViewChild('parent') public elm: any;
|
||||
@ViewChild('parent', {static: false}) public elm: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -2161,7 +2156,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
public exp1: any;
|
||||
public exp2: any;
|
||||
|
||||
@ViewChild('parent') public elm: any;
|
||||
@ViewChild('parent', {static: false}) public elm: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -2213,7 +2208,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
public exp1: any;
|
||||
public exp2: any;
|
||||
|
||||
@ViewChild('parent') public elm: any;
|
||||
@ViewChild('parent', {static: false}) public elm: any;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
@ -2262,7 +2257,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
})
|
||||
class ParentCmp {
|
||||
public exp: boolean = true;
|
||||
@ViewChild('child') public childElm: any;
|
||||
@ViewChild('child', {static: false}) public childElm: any;
|
||||
|
||||
public childEvent: any;
|
||||
|
||||
|
@ -2698,7 +2693,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
class ParentCmp {
|
||||
public exp: any;
|
||||
|
||||
@ViewChild('child') public childCmp: any;
|
||||
@ViewChild('child', {static: false}) public childCmp: any;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -2762,7 +2757,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
`
|
||||
})
|
||||
class ParentCmp {
|
||||
@ViewChild('child') public childCmp: any;
|
||||
@ViewChild('child', {static: false}) public childCmp: any;
|
||||
|
||||
public exp: any;
|
||||
public log: string[] = [];
|
||||
|
@ -2940,7 +2935,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
class ParentCmp {
|
||||
public exp: any;
|
||||
|
||||
@ViewChild('child') public childCmp: any;
|
||||
@ViewChild('child', {static: false}) public childCmp: any;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -3018,13 +3013,13 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
class ParentCmp {
|
||||
public exp: any;
|
||||
|
||||
@ViewChild('child') public innerCmp: any;
|
||||
@ViewChild('child', {static: false}) public innerCmp: any;
|
||||
}
|
||||
|
||||
@Component(
|
||||
{selector: 'child-cmp', template: '<grandchild-cmp #grandchild></grandchild-cmp>'})
|
||||
class ChildCmp {
|
||||
@ViewChild('grandchild') public innerCmp: any;
|
||||
@ViewChild('grandchild', {static: false}) public innerCmp: any;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -11,7 +11,6 @@ import {AnimationGroupPlayer} from '@angular/animations/src/players/animation_gr
|
|||
import {Component, ViewChild} from '@angular/core';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {browserDetection} from '@angular/platform-browser/testing/src/browser_util';
|
||||
import {ivyEnabled} from '@angular/private/testing';
|
||||
|
||||
import {TestBed} from '../../testing';
|
||||
|
||||
|
@ -166,7 +165,7 @@ import {TestBed} from '../../testing';
|
|||
]
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('elm') public element: any;
|
||||
@ViewChild('elm', {static: false}) public element: any;
|
||||
|
||||
public myAnimationExp = '';
|
||||
}
|
||||
|
@ -217,7 +216,7 @@ import {TestBed} from '../../testing';
|
|||
]
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('elm') public element: any;
|
||||
@ViewChild('elm', {static: false}) public element: any;
|
||||
|
||||
public myAnimationExp = '';
|
||||
}
|
||||
|
@ -280,7 +279,7 @@ import {TestBed} from '../../testing';
|
|||
]
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('elm') public element: any;
|
||||
@ViewChild('elm', {static: true}) public element: any;
|
||||
|
||||
public myAnimationExp = '';
|
||||
}
|
||||
|
@ -291,10 +290,6 @@ import {TestBed} from '../../testing';
|
|||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
// In Ivy, change detection needs to run before the ViewQuery for cmp.element will resolve.
|
||||
// Keeping this test enabled since we still want to test the animation logic in Ivy.
|
||||
if (ivyEnabled) fixture.detectChanges();
|
||||
|
||||
const elm = cmp.element.nativeElement;
|
||||
const foo = elm.querySelector('.foo') as HTMLElement;
|
||||
|
||||
|
@ -332,7 +327,7 @@ import {TestBed} from '../../testing';
|
|||
]
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('elm') public element: any;
|
||||
@ViewChild('elm', {static: true}) public element: any;
|
||||
|
||||
public myAnimationExp = '';
|
||||
}
|
||||
|
@ -343,10 +338,6 @@ import {TestBed} from '../../testing';
|
|||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
// In Ivy, change detection needs to run before the ViewQuery for cmp.element will resolve.
|
||||
// Keeping this test enabled since we still want to test the animation logic in Ivy.
|
||||
if (ivyEnabled) fixture.detectChanges();
|
||||
|
||||
const elm = cmp.element.nativeElement;
|
||||
expect(elm.style.getPropertyValue('display')).toEqual('table');
|
||||
expect(elm.style.getPropertyValue('position')).toEqual('fixed');
|
||||
|
|
|
@ -479,7 +479,7 @@ import {ivyEnabled} from '@angular/private/testing';
|
|||
]
|
||||
})
|
||||
class Cmp {
|
||||
@ViewChild('elm') public element: any;
|
||||
@ViewChild('elm', {static: true}) public element: any;
|
||||
|
||||
public myAnimationExp = '';
|
||||
}
|
||||
|
@ -490,10 +490,6 @@ import {ivyEnabled} from '@angular/private/testing';
|
|||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
// In Ivy, change detection needs to run before the ViewQuery for cmp.element will resolve.
|
||||
// Keeping this test enabled since we still want to test the animation logic in Ivy.
|
||||
if (ivyEnabled) fixture.detectChanges();
|
||||
|
||||
const elm = cmp.element.nativeElement;
|
||||
expect(elm.style.getPropertyValue('display')).toEqual('table');
|
||||
expect(elm.style.getPropertyValue('position')).toEqual('fixed');
|
||||
|
|
|
@ -16,7 +16,6 @@ import {BrowserModule} from '@angular/platform-browser';
|
|||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {ivyEnabled} from '@angular/private/testing';
|
||||
|
||||
import {NoopNgZone} from '../src/zone/ng_zone';
|
||||
import {ComponentFixtureNoNgZone, TestBed, async, inject, withModule} from '../testing';
|
||||
|
@ -386,14 +385,14 @@ class SomeComponent {
|
|||
@Component({template: '<ng-container #vc></ng-container>'})
|
||||
class ContainerComp {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ViewChild('vc', {read: ViewContainerRef})
|
||||
@ViewChild('vc', {read: ViewContainerRef, static: false})
|
||||
vc !: ViewContainerRef;
|
||||
}
|
||||
|
||||
@Component({template: '<ng-template #t>Dynamic content</ng-template>'})
|
||||
class EmbeddedViewComp {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ViewChild(TemplateRef)
|
||||
@ViewChild(TemplateRef, {static: true})
|
||||
tplRef !: TemplateRef<Object>;
|
||||
}
|
||||
|
||||
|
@ -447,10 +446,6 @@ class SomeComponent {
|
|||
const comp = TestBed.createComponent(EmbeddedViewComp);
|
||||
const appRef: ApplicationRef = TestBed.get(ApplicationRef);
|
||||
|
||||
// In Ivy, change detection needs to run before the ViewQuery for tplRef will resolve.
|
||||
// Keeping this test enabled since we still want to test this destroy logic in Ivy.
|
||||
if (ivyEnabled) comp.detectChanges();
|
||||
|
||||
const embeddedViewRef = comp.componentInstance.tplRef.createEmbeddedView({});
|
||||
|
||||
appRef.attachView(embeddedViewRef);
|
||||
|
|
|
@ -160,7 +160,7 @@ class BankAccount {
|
|||
`
|
||||
})
|
||||
class SimpleContentComp {
|
||||
@ViewChild('content') content !: ElementRef;
|
||||
@ViewChild('content', {static: false}) content !: ElementRef;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -1356,9 +1356,9 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
|
|||
class Comp {
|
||||
name = 'Tom';
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ViewChild('vc', {read: ViewContainerRef}) vc !: ViewContainerRef;
|
||||
@ViewChild('vc', {read: ViewContainerRef, static: true}) vc !: ViewContainerRef;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ViewChild(TemplateRef) template !: TemplateRef<any>;
|
||||
@ViewChild(TemplateRef, {static: true}) template !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Comp]});
|
||||
|
@ -1399,7 +1399,7 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
|
|||
})
|
||||
class OuterComp {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ContentChild(TemplateRef)
|
||||
@ContentChild(TemplateRef, {static: true})
|
||||
tpl !: TemplateRef<any>;
|
||||
|
||||
constructor(public cdRef: ChangeDetectorRef) {}
|
||||
|
@ -1413,7 +1413,7 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
|
|||
})
|
||||
class InnerComp {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ContentChild(TemplateRef)
|
||||
@ContentChild(TemplateRef, {static: true})
|
||||
tpl !: TemplateRef<any>;
|
||||
|
||||
// TODO(issue/24571): remove '!'.
|
||||
|
|
|
@ -689,7 +689,7 @@ describe('projection', () => {
|
|||
|
||||
@Component({selector: 'with-content', template: ''})
|
||||
class WithContentCmpt {
|
||||
@ViewChild('ref') directiveRef: any;
|
||||
@ViewChild('ref', {static: true}) directiveRef: any;
|
||||
}
|
||||
|
||||
@Component({selector: 're-project', template: '<ng-content></ng-content>'})
|
||||
|
|
|
@ -362,7 +362,7 @@ function declareTests(config?: {useJit: boolean}) {
|
|||
@Directive({selector: 'test'})
|
||||
class Test {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() @ContentChild(TemplateRef) tpl !: TemplateRef<any>;
|
||||
@Input() @ContentChild(TemplateRef, {static: true}) tpl !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -392,7 +392,7 @@ function declareTests(config?: {useJit: boolean}) {
|
|||
.it('should throw if @ContentChild and @Input are on the same property', () => {
|
||||
@Directive({selector: 'test'})
|
||||
class Test {
|
||||
@Input() @ContentChild(TemplateRef) tpl !: TemplateRef<any>;
|
||||
@Input() @ContentChild(TemplateRef, {static: true}) tpl !: TemplateRef<any>;
|
||||
}
|
||||
|
||||
@Component({selector: 'my-app', template: `<test></test>`})
|
||||
|
|
Loading…
Reference in New Issue