fix(ivy): properly determine the first native node of a view (#33627)
PR Close #33627
This commit is contained in:

committed by
Kara Erickson

parent
c8c51a9879
commit
811275cd15
@ -10,6 +10,7 @@ import {CommonModule} from '@angular/common';
|
||||
import {ChangeDetectorRef, Component, ComponentFactoryResolver, Directive, EmbeddedViewRef, Injector, NgModule, TemplateRef, ViewChild, ViewContainerRef, ViewRef} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {By} from '@angular/platform-browser';
|
||||
import {onlyInIvy} from '@angular/private/testing';
|
||||
|
||||
describe('view insertion', () => {
|
||||
describe('of a simple template', () => {
|
||||
@ -347,6 +348,26 @@ describe('view insertion', () => {
|
||||
|
||||
});
|
||||
|
||||
onlyInIvy('VE incorrectly inserts views before ng-container content')
|
||||
.it('should insert before a view with a ng-container where ViewContainerRef is injected',
|
||||
() => {
|
||||
expect(createAndInsertViews(`
|
||||
<ng-container [ngTemplateOutlet]="after">|before</ng-container>
|
||||
<ng-template #after>|after</ng-template>
|
||||
`).textContent)
|
||||
.toBe('insert|before|after');
|
||||
|
||||
});
|
||||
|
||||
it('should insert before a view with an element where ViewContainerRef is injected', () => {
|
||||
expect(createAndInsertViews(`
|
||||
<div [ngTemplateOutlet]="after">|before</div>
|
||||
<ng-template #after>|after</ng-template>
|
||||
`).textContent)
|
||||
.toBe('insert|before|after');
|
||||
|
||||
});
|
||||
|
||||
it('should insert before a view with an empty projection as the first root node', () => {
|
||||
expect(createAndInsertViews(`<ng-content></ng-content>|before`).textContent)
|
||||
.toBe('insert|before');
|
||||
|
Reference in New Issue
Block a user