Skip to content

Commit 3f8e946

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Calc actual % instead of hardcoding.
1 parent b7ab9e9 commit 3f8e946

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

projects/igniteui-angular/src/lib/grids/grid/column-resizing.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,12 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
583583
it('should autosize column with % width programmatically.', fakeAsync(() => {
584584
grid.height = null;
585585
fixture.detectChanges();
586-
expect(grid.columnList.get(0).width).toBe('25%');
587-
grid.columnList.get(0).autosize();
586+
const col = grid.columnList.get(0);
587+
expect(col.width).toBe('25%');
588+
col.autosize();
588589
fixture.detectChanges();
589-
expect(grid.columnList.get(0).width).toBe('32%');
590+
const calcPercent = (col.getHeaderCellWidths().width + col.getHeaderCellWidths().padding) / grid.calcWidth * 100;
591+
expect(grid.columnList.get(0).width).toBe(calcPercent + '%');
590592
}));
591593

592594
it('should autosize column with % width on double click.', fakeAsync(() => {
@@ -598,7 +600,9 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
598600
UIInteractions.simulateMouseEvent('dblclick', headerResArea, 0, 0);
599601
tick(200);
600602
fixture.detectChanges();
601-
expect(grid.columnList.get(0).width).toBe('32%');
603+
const col = grid.columnList.get(0);
604+
const calcPercent = (col.getHeaderCellWidths().width + col.getHeaderCellWidths().padding) / grid.calcWidth * 100;
605+
expect(col.width).toBe(calcPercent + '%');
602606
}));
603607
});
604608

0 commit comments

Comments
 (0)