From 84a010562546cd2727f9c6ff51404779007b8cd4 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Tue, 12 Nov 2019 10:29:58 +0100 Subject: [PATCH] test(ivy): view insertion before ng-container with a ViewContainerRef (#33755) Closes #33679 PR Close #33755 --- .../test/acceptance/view_insertion_spec.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) 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', () => {