Skip to content

Commit

Permalink
test(ivy): add root cause analysis for the remaining projection test
Browse files Browse the repository at this point in the history
Initial thinking was that the bug is in the content projection logic but
it turned out to be a wrong assumption - hence adding a test to illustrate
that basic content projection of view containers works correctly.

What fails in the marked test is the logic quering debug nodes - content
peojection is fine but we never create the 'B' text node since we call
show() method on the "wrong" directive instance.
  • Loading branch information
pkozlowski-opensource committed Jan 15, 2019
1 parent bdf0af7 commit 6aae8b2
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion packages/core/test/linker/projection_integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,33 @@ describe('projection', () => {
expect(main.nativeElement).toHaveText('B(A)');
});

fixmeIvy('unknown').it('should project filled view containers into a view container', () => {
it('should project view containers', () => {
TestBed.configureTestingModule(
{declarations: [SingleContentTagComponent, ManualViewportDirective]});
TestBed.overrideComponent(MainComp, {
set: {
template: '<single-content-tag>' +
'<div class="target">A</div>' +
'<ng-template manual class="target">B</ng-template>' +
'<div class="target">C</div>' +
'</single-content-tag>'
}
});

const main = TestBed.createComponent(MainComp);
const manualDirective =
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get(
ManualViewportDirective);

expect(main.nativeElement).toHaveText('AC');

manualDirective.show();
main.detectChanges();
expect(main.nativeElement).toHaveText('ABC');
});

fixmeIvy('FW-869: debugElement.queryAllNodes returns nodes in the wrong order')
it('should project filled view containers into a view container', () => {
TestBed.configureTestingModule(
{declarations: [ConditionalContentComponent, ManualViewportDirective]});
TestBed.overrideComponent(MainComp, {
Expand Down

0 comments on commit 6aae8b2

Please sign in to comment.