Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Commit 345deed

Browse files
committed
feat: add unit test to check duplication with ngTemplateRef
1 parent 05fc904 commit 345deed

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

demo/src/app/advanced/using-ng-template-ref.component.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,26 @@ describe('UsingNgTemplateRefComponent', () => {
7575

7676
});
7777

78+
it('should not have duplicate contents in ngTemplateRef column when navigating pages', async () => {
79+
await fixture.whenStable();
80+
fixture.detectChanges();
81+
82+
const query = fixture.debugElement.query(By.directive(DataTableDirective));
83+
const dir = query.injector.get(DataTableDirective);
84+
expect(dir).toBeTruthy();
85+
86+
// trigger pagination events
87+
(await dir.dtInstance).page(2).draw(false);
88+
await fixture.whenRenderingDone();
89+
90+
(await dir.dtInstance).page(0).draw(false);
91+
await fixture.whenRenderingDone();
92+
fixture.detectChanges();
93+
94+
// verify no duplication
95+
const firstRow = fixture.debugElement.query(By.css('tbody'));
96+
const templatedCell = firstRow.children[0].children[3];
97+
expect(templatedCell.children.length).toBe(1);
98+
});
99+
78100
});

0 commit comments

Comments
 (0)