From b6988e52cc863efae7f65d6bc887e55ed091e2b1 Mon Sep 17 00:00:00 2001 From: Martin Dragnev Date: Fri, 10 Jan 2025 15:07:37 +0200 Subject: [PATCH] test(for-of): Add a test for igxForInitialChunkSize --- .../directives/for-of/for_of.directive.spec.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts b/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts index 478cbfd8feb..abc46f747e0 100644 --- a/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts +++ b/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts @@ -372,6 +372,16 @@ describe('IgxForOf directive -', () => { await wait(200); expect(cache).toEqual([130, 100, 100, 100, 100, 100, 100, 130, 130, 130]); }); + + it('should render no more that initial chunk size elements when set if no containerSize', () => { + fix.componentInstance.height = undefined; + fix.componentInstance.initialChunkSize = 3; + fix.detectChanges(); + expect(displayContainer).not.toBeNull(); + expect(verticalScroller).not.toBeNull(); + expect(horizontalScroller).toBeNull(); + expect(displayContainer.children.length).toBe(3); + }); }); describe('vertical virtual component no data', () => { @@ -407,7 +417,6 @@ describe('IgxForOf directive -', () => { rowsRendered = displayContainer.querySelectorAll('div'); expect(rowsRendered.length).not.toBe(0); }); - }); describe('vertical and horizontal virtual component', () => { @@ -1471,7 +1480,8 @@ export class VirtualComponent { + [igxForItemSize]='itemSize' + [igxForInitialChunkSize]='initialChunkSize'>
@@ -1499,6 +1509,7 @@ export class VerticalVirtualComponent extends VirtualComponent { ]; public override data = []; public itemSize = '50px'; + public initialChunkSize; } @Component({