fix(compiler): query <template>
elements before their children. (#13677)
Fixes #13118 Closes #13167
This commit is contained in:
@ -43,6 +43,8 @@ export function main() {
|
||||
NeedsContentChildWithRead,
|
||||
NeedsViewChildrenWithRead,
|
||||
NeedsViewChildWithRead,
|
||||
NeedsContentChildTemplateRef,
|
||||
NeedsContentChildTemplateRefApp,
|
||||
NeedsViewContainerWithRead,
|
||||
ManualProjecting
|
||||
]
|
||||
@ -262,6 +264,15 @@ export function main() {
|
||||
expect(comp.textDirChild.text).toEqual('ca');
|
||||
});
|
||||
|
||||
it('should contain the first descendant content child templateRef', () => {
|
||||
const template = '<needs-content-child-template-ref-app>' +
|
||||
'</needs-content-child-template-ref-app>';
|
||||
const view = createTestCmpAndDetectChanges(MyComp0, template);
|
||||
|
||||
view.detectChanges();
|
||||
expect(view.nativeElement).toHaveText('OUTER');
|
||||
});
|
||||
|
||||
it('should contain the first view child', () => {
|
||||
const template = '<needs-view-child-read></needs-view-child-read>';
|
||||
const view = createTestCmpAndDetectChanges(MyComp0, template);
|
||||
@ -730,6 +741,23 @@ class NeedsContentChildWithRead {
|
||||
@ContentChild('nonExisting', {read: TextDirective}) nonExistingVar: TextDirective;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'needs-content-child-template-ref',
|
||||
template: '<div [ngTemplateOutlet]="templateRef"></div>'
|
||||
})
|
||||
class NeedsContentChildTemplateRef {
|
||||
@ContentChild(TemplateRef) templateRef: TemplateRef<any>;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'needs-content-child-template-ref-app',
|
||||
template: '<needs-content-child-template-ref>' +
|
||||
'<template>OUTER<template>INNER</template></template>' +
|
||||
'</needs-content-child-template-ref>'
|
||||
})
|
||||
class NeedsContentChildTemplateRefApp {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'needs-view-children-read',
|
||||
template: '<div #q text="va"></div><div #w text="vb"></div>',
|
||||
|
Reference in New Issue
Block a user