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:
crisbeto
2019-10-05 10:04:54 +02:00
committed by Matias Niemelä
parent 7e64bbe5a8
commit 9d54679e66
46 changed files with 273 additions and 279 deletions

View File

@ -1622,7 +1622,7 @@ describe('compiler compliance', () => {
})
export class ViewQueryComponent {
@ViewChild(SomeDirective, {static: true}) someDir !: SomeDirective;
@ViewChild('foo', {static: false}) foo !: ElementRef;
@ViewChild('foo') foo !: ElementRef;
}
@NgModule({declarations: [SomeDirective, ViewQueryComponent]})
@ -1740,7 +1740,7 @@ describe('compiler compliance', () => {
\`
})
export class ContentQueryComponent {
@ContentChild(SomeDirective, {static: false}) someDir: SomeDirective;
@ContentChild(SomeDirective) someDir: SomeDirective;
@ContentChildren(SomeDirective) someDirList !: QueryList<SomeDirective>;
}
@ -1809,7 +1809,7 @@ describe('compiler compliance', () => {
\`
})
export class ContentQueryComponent {
@ContentChild('myRef', {static: false}) myRef: any;
@ContentChild('myRef') myRef: any;
@ContentChildren('myRef1, myRef2, myRef3') myRefs: QueryList<any>;
}
@NgModule({declarations: [ContentQueryComponent]})
@ -1860,7 +1860,7 @@ describe('compiler compliance', () => {
})
export class ContentQueryComponent {
@ContentChild(SomeDirective, {static: true}) someDir !: SomeDirective;
@ContentChild('foo', {static: false}) foo !: ElementRef;
@ContentChild('foo') foo !: ElementRef;
}
@Component({
@ -1931,9 +1931,9 @@ describe('compiler compliance', () => {
\`
})
export class ContentQueryComponent {
@ContentChild('myRef', {read: TemplateRef, static: false}) myRef: TemplateRef;
@ContentChild('myRef', {read: TemplateRef}) myRef: TemplateRef;
@ContentChildren('myRef1, myRef2, myRef3', {read: ElementRef}) myRefs: QueryList<ElementRef>;
@ContentChild(SomeDirective, {read: ElementRef, static: false}) someDir: ElementRef;
@ContentChild(SomeDirective, {read: ElementRef}) someDir: ElementRef;
@ContentChildren(SomeDirective, {read: TemplateRef}) someDirs: QueryList<TemplateRef>;
}
@NgModule({declarations: [ContentQueryComponent]})
@ -3210,7 +3210,7 @@ describe('compiler compliance', () => {
'spec.ts': `
import {Component, NgModule, ContentChild} from '@angular/core';
export class BaseClass {
@ContentChild('something', {static: false}) something: any;
@ContentChild('something') something: any;
}
@Component({

View File

@ -1094,7 +1094,7 @@ runInEachFileSystem(os => {
template: '<ng-content></ng-content>'
})
export class TestCmp {
@Input() @ContentChild('foo', {static: false}) foo: any;
@Input() @ContentChild('foo') foo: any;
}
`);
@ -1116,7 +1116,7 @@ runInEachFileSystem(os => {
})
export class TestCmp {
@ContentChild('bar', {static: true})
@ContentChild('foo', {static: false})
@ContentChild('foo')
foo: any;
}
`);
@ -1138,7 +1138,7 @@ runInEachFileSystem(os => {
template: '...'
})
export class TestCmp {
@ContentChild('foo', {static: false})
@ContentChild('foo')
private someFn() {}
}
`);
@ -1653,10 +1653,10 @@ runInEachFileSystem(os => {
}
})
class FooCmp {
@ContentChild('bar', {read: TemplateRef, static: false}) child: any;
@ContentChild('bar', {read: TemplateRef}) child: any;
@ContentChildren(TemplateRef) children: any;
get aview(): any { return null; }
@ViewChild('accessor', {static: false}) set aview(value: any) {}
@ViewChild('accessor') set aview(value: any) {}
}
`);
@ -1684,7 +1684,7 @@ runInEachFileSystem(os => {
}
})
class FooCmp {
@ContentChild('bar', {read: TemplateRef, static: false}) child: any;
@ContentChild('bar', {read: TemplateRef}) child: any;
@ContentChildren(TemplateRef) children: any;
get aview(): any { return null; }
@ViewChild('accessor') set aview(value: any) {}
@ -1715,11 +1715,11 @@ runInEachFileSystem(os => {
template: '<div #foo></div>',
})
class FooCmp {
@ContentChild(forwardRef(() => TemplateRef), {static: false}) child: any;
@ContentChild(forwardRef(() => TemplateRef)) child: any;
@ContentChild(forwardRef(function() { return ViewContainerRef; }), {static: false}) child2: any;
@ContentChild(forwardRef(function() { return ViewContainerRef; })) child2: any;
@ContentChild((forwardRef((function() { return 'parens'; }) as any)), {static: false}) childInParens: any;
@ContentChild((forwardRef((function() { return 'parens'; }) as any))) childInParens: any;
}
`);