test(compiler): update examples and compiler tests (#30626)

PR Close #30626
This commit is contained in:
Kara Erickson
2019-05-22 20:42:34 -07:00
committed by Jason Aden
parent dcdecfa9a8
commit 214ae0ea4c
10 changed files with 49 additions and 43 deletions

View File

@ -1714,7 +1714,7 @@ describe('compiler compliance', () => {
\`
})
export class ContentQueryComponent {
@ContentChild(SomeDirective) someDir: SomeDirective;
@ContentChild(SomeDirective, {static: false}) someDir: SomeDirective;
@ContentChildren(SomeDirective) someDirList !: QueryList<SomeDirective>;
}
@ -1786,7 +1786,7 @@ describe('compiler compliance', () => {
\`
})
export class ContentQueryComponent {
@ContentChild('myRef') myRef: any;
@ContentChild('myRef', {static: false}) myRef: any;
@ContentChildren('myRef1, myRef2, myRef3') myRefs: QueryList<any>;
}
@NgModule({declarations: [ContentQueryComponent]})
@ -1911,9 +1911,9 @@ describe('compiler compliance', () => {
\`
})
export class ContentQueryComponent {
@ContentChild('myRef', {read: TemplateRef}) myRef: TemplateRef;
@ContentChild('myRef', {read: TemplateRef, static: false}) myRef: TemplateRef;
@ContentChildren('myRef1, myRef2, myRef3', {read: ElementRef}) myRefs: QueryList<ElementRef>;
@ContentChild(SomeDirective, {read: ElementRef}) someDir: ElementRef;
@ContentChild(SomeDirective, {read: ElementRef, static: false}) someDir: ElementRef;
@ContentChildren(SomeDirective, {read: TemplateRef}) someDirs: QueryList<TemplateRef>;
}
@NgModule({declarations: [ContentQueryComponent]})
@ -1966,7 +1966,7 @@ describe('compiler compliance', () => {
\`
})
export class ContentQueryComponent {
@Input() @ContentChild('foo') foo: any;
@Input() @ContentChild('foo', {static: false}) foo: any;
}
@Component({
@ -3139,7 +3139,7 @@ describe('compiler compliance', () => {
'spec.ts': `
import {Component, NgModule, ContentChild} from '@angular/core';
export class BaseClass {
@ContentChild('something') something: any;
@ContentChild('something', {static: false}) something: any;
}
@Component({

View File

@ -1536,10 +1536,10 @@ describe('ngtsc behavioral tests', () => {
}
})
class FooCmp {
@ContentChild('bar', {read: TemplateRef}) child: any;
@ContentChild('bar', {read: TemplateRef, static: false}) child: any;
@ContentChildren(TemplateRef) children: any;
get aview(): any { return null; }
@ViewChild('accessor') set aview(value: any) {}
@ViewChild('accessor', {static: false}) set aview(value: any) {}
}
`);
@ -1568,7 +1568,7 @@ describe('ngtsc behavioral tests', () => {
}
})
class FooCmp {
@ContentChild('bar', {read: TemplateRef}) child: any;
@ContentChild('bar', {read: TemplateRef, static: false}) child: any;
@ContentChildren(TemplateRef) children: any;
get aview(): any { return null; }
@ViewChild('accessor') set aview(value: any) {}
@ -1600,11 +1600,11 @@ describe('ngtsc behavioral tests', () => {
template: '<div #foo></div>',
})
class FooCmp {
@ContentChild(forwardRef(() => TemplateRef)) child: any;
@ContentChild(forwardRef(() => TemplateRef), {static: false}) child: any;
@ContentChild(forwardRef(function() { return ViewContainerRef; })) child2: any;
@ContentChild(forwardRef(function() { return ViewContainerRef; }), {static: false}) child2: any;
@ContentChild((forwardRef((function() { return 'parens'; }) as any))) childInParens: any;
@ContentChild((forwardRef((function() { return 'parens'; }) as any)), {static: false}) childInParens: any;
}
`);