test(core): update query-specific tests in core (#30626)

PR Close #30626
This commit is contained in:
Kara Erickson
2019-05-22 21:05:26 -07:00
committed by Jason Aden
parent 214ae0ea4c
commit faac51fd2e
3 changed files with 44 additions and 41 deletions

View File

@ -177,7 +177,7 @@ describe('query logic', () => {
it('should support ViewChild query inherited from undecorated superclasses', () => {
class MyComp {
@ViewChild('foo') foo: any;
@ViewChild('foo', {static: false}) 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') foo: any;
@ViewChild('foo', {static: false}) foo: any;
}
class MyComp extends MySuperComp {}
@ -493,7 +493,7 @@ describe('query logic', () => {
it('should support ContentChild query inherited from undecorated superclasses', () => {
class MyComp {
@ContentChild('foo') foo: any;
@ContentChild('foo', {static: false}) foo: any;
}
@Component({selector: 'sub-comp', template: '<ng-content></ng-content>'})
@ -502,7 +502,7 @@ describe('query logic', () => {
@Component({template: '<sub-comp><div #foo></div></sub-comp>'})
class App {
@ViewChild(SubComp) subComp !: SubComp;
@ViewChild(SubComp, {static: false}) subComp !: SubComp;
}
TestBed.configureTestingModule({declarations: [App, SubComp]});
@ -514,7 +514,7 @@ describe('query logic', () => {
it('should support ContentChild query inherited from undecorated grand superclasses', () => {
class MySuperComp {
@ContentChild('foo') foo: any;
@ContentChild('foo', {static: false}) foo: any;
}
class MyComp extends MySuperComp {}
@ -525,7 +525,7 @@ describe('query logic', () => {
@Component({template: '<sub-comp><div #foo></div></sub-comp>'})
class App {
@ViewChild(SubComp) subComp !: SubComp;
@ViewChild(SubComp, {static: false}) subComp !: SubComp;
}
TestBed.configureTestingModule({declarations: [App, SubComp]});
@ -557,7 +557,7 @@ describe('query logic', () => {
`
})
class App {
@ViewChild(SubComp) subComp !: SubComp;
@ViewChild(SubComp, {static: false}) subComp !: SubComp;
}
TestBed.configureTestingModule({declarations: [App, SubComp, SomeDir]});
@ -592,7 +592,7 @@ describe('query logic', () => {
`
})
class App {
@ViewChild(SubComp) subComp !: SubComp;
@ViewChild(SubComp, {static: false}) subComp !: SubComp;
}
TestBed.configureTestingModule({declarations: [App, SubComp, SomeDir]});
@ -806,9 +806,10 @@ describe('query logic', () => {
`,
})
class TestComponent {
@ViewChild(ViewContainerManipulatorDirective) vc !: ViewContainerManipulatorDirective;
@ViewChild('tpl1') tpl1 !: TemplateRef<any>;
@ViewChild('tpl2') tpl2 !: TemplateRef<any>;
@ViewChild(ViewContainerManipulatorDirective, {static: false})
vc !: ViewContainerManipulatorDirective;
@ViewChild('tpl1', {static: false}) tpl1 !: TemplateRef<any>;
@ViewChild('tpl2', {static: false}) tpl2 !: TemplateRef<any>;
@ViewChildren('foo') query !: QueryList<any>;
}
@ -878,9 +879,9 @@ describe('query logic', () => {
`,
})
class TestComponent {
@ViewChild('tpl') tpl !: TemplateRef<any>;
@ViewChild('vi0') vi0 !: ViewContainerManipulatorDirective;
@ViewChild('vi1') vi1 !: ViewContainerManipulatorDirective;
@ViewChild('tpl', {static: false}) tpl !: TemplateRef<any>;
@ViewChild('vi0', {static: false}) vi0 !: ViewContainerManipulatorDirective;
@ViewChild('vi1', {static: false}) vi1 !: ViewContainerManipulatorDirective;
@ViewChildren('foo') query !: QueryList<any>;
}
@ -963,8 +964,8 @@ function initWithTemplate(compType: Type<any>, template: string) {
@Component({selector: 'local-ref-query-component', template: '<ng-content></ng-content>'})
class QueryComp {
@ViewChild('viewQuery') viewChild !: any;
@ContentChild('contentQuery') contentChild !: any;
@ViewChild('viewQuery', {static: false}) viewChild !: any;
@ContentChild('contentQuery', {static: false}) contentChild !: any;
@ViewChildren('viewQuery') viewChildren !: QueryList<any>;
@ContentChildren('contentQuery') contentChildren !: QueryList<any>;