fix(core): fix `isComponentView()` and `isEmbeddedView()` tests (#14789)
fixes #14778
This commit is contained in:
parent
d1182af1a4
commit
5753de50f0
|
@ -34,6 +34,15 @@ export function main() {
|
|||
});
|
||||
});
|
||||
|
||||
// https://github.com/angular/angular/issues/14778
|
||||
it('should accept the component as the context', async(() => {
|
||||
const template = `<ng-container *ngTemplateOutlet="tpl; context: this"></ng-container>` +
|
||||
`<ng-template #tpl>{{context.foo}}</ng-template>`;
|
||||
|
||||
fixture = createTestComponent(template);
|
||||
detectChangesAndExpectText('bar');
|
||||
}));
|
||||
|
||||
it('should do nothing if templateRef is `null`', async(() => {
|
||||
const template = `<ng-container [ngTemplateOutlet]="null"></ng-container>`;
|
||||
fixture = createTestComponent(template);
|
||||
|
|
|
@ -141,11 +141,11 @@ export function elementEventFullName(target: string, name: string): string {
|
|||
}
|
||||
|
||||
export function isComponentView(view: ViewData): boolean {
|
||||
return view.component === view.context && !!view.parent;
|
||||
return !!view.parent && !!(view.parentNodeDef.flags & NodeFlags.Component);
|
||||
}
|
||||
|
||||
export function isEmbeddedView(view: ViewData): boolean {
|
||||
return view.component !== view.context && !!view.parent;
|
||||
return !!view.parent && !(view.parentNodeDef.flags & NodeFlags.Component);
|
||||
}
|
||||
|
||||
export function filterQueryId(queryId: number): number {
|
||||
|
|
Loading…
Reference in New Issue