Skip to content

Commit

Permalink
test(for-of): Add a test for igxForInitialChunkSize
Browse files Browse the repository at this point in the history
  • Loading branch information
mddragnev committed Jan 10, 2025
1 parent 728d38d commit b6988e5
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -407,7 +417,6 @@ describe('IgxForOf directive -', () => {
rowsRendered = displayContainer.querySelectorAll('div');
expect(rowsRendered.length).not.toBe(0);
});

});

describe('vertical and horizontal virtual component', () => {
Expand Down Expand Up @@ -1471,7 +1480,8 @@ export class VirtualComponent {
<ng-template #scrollContainer igxForTest let-rowData [igxForOf]="data"
[igxForScrollOrientation]="'vertical'"
[igxForContainerSize]='height'
[igxForItemSize]='itemSize'>
[igxForItemSize]='itemSize'
[igxForInitialChunkSize]='initialChunkSize'>
<div [style.display]="'flex'"
[style.height]="rowData.height || itemSize || '50px'"
[style.margin-top]="rowData.margin || '0px'">
Expand Down Expand Up @@ -1499,6 +1509,7 @@ export class VerticalVirtualComponent extends VirtualComponent {
];
public override data = [];
public itemSize = '50px';
public initialChunkSize;
}

@Component({
Expand Down

0 comments on commit b6988e5

Please sign in to comment.