diff --git a/packages/core/test/acceptance/view_insertion_spec.ts b/packages/core/test/acceptance/view_insertion_spec.ts index 862e23c725..eed47660af 100644 --- a/packages/core/test/acceptance/view_insertion_spec.ts +++ b/packages/core/test/acceptance/view_insertion_spec.ts @@ -356,6 +356,7 @@ describe('view insertion', () => { }); + it('should insert before a view with an element where ViewContainerRef is injected', () => { expect(createAndInsertViews(`
|before
@@ -383,6 +384,37 @@ describe('view insertion', () => { .toBe('insert|before'); }); + it('should insert before a ng-container with a ViewContainerRef on it', () => { + @Component({ + selector: 'app-root', + template: ` +
start|
+ + +
|end
+ + test + ` + }) + class AppComponent { + insertTpl = false; + } + + TestBed.configureTestingModule({ + declarations: [AppComponent], + imports: [CommonModule], + }); + + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + + expect(fixture.debugElement.nativeElement.textContent).toBe('start|test|end'); + + fixture.componentInstance.insertTpl = true; + fixture.detectChanges(); + expect(fixture.debugElement.nativeElement.textContent).toBe('start|testtest|end'); + }); + }); describe('before embedded view with projection', () => {