test(core): update core tests (unrelated to queries) to use static flag (#30626)

PR Close #30626
This commit is contained in:
Kara Erickson
2019-05-22 17:15:41 -07:00
committed by Jason Aden
parent 21e8ac1e02
commit 4299ecf9be
24 changed files with 185 additions and 203 deletions

View File

@ -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 '!'.

View File

@ -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>'})

View File

@ -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>`})