Skip to content

Commit e3da3c3

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Update tests to consider borders.
1 parent 726e0cf commit e3da3c3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,9 @@ describe('IgxGrid - Deferred Column Resizing #grid', () => {
861861
expect(filteringCells[1].nativeElement.getBoundingClientRect().width).toBe(50);
862862
expect(filteringCells[2].nativeElement.getBoundingClientRect().width).toBe(49);
863863

864-
expect(headerGroups[0].nativeElement.getBoundingClientRect().width).toBe(48);
864+
expect(headerGroups[0].nativeElement.getBoundingClientRect().width).toBe(49);
865865
expect(headerGroups[1].nativeElement.getBoundingClientRect().width).toBe(50);
866-
expect(headerGroups[2].nativeElement.getBoundingClientRect().width).toBe(48);
866+
expect(headerGroups[2].nativeElement.getBoundingClientRect().width).toBe(49);
867867
});
868868

869869
it('should size headers correctly when column width is in %.', () => {

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,9 +1888,12 @@ describe('IgxGrid Component Tests #grid', () => {
18881888
expect(hScroll.nativeElement.hidden).toBe(true);
18891889

18901890
for (let i = 0; i < grid.columnList.length; i++) {
1891-
const header = fix.debugElement.queryAll(By.css('igx-grid-header-group'))[i];
1891+
const header = fix.debugElement.queryAll(By.css('igx-grid-header'))[i];
18921892
const cell = fix.debugElement.queryAll(By.css('igx-grid-cell'))[i];
1893-
expect(header.nativeElement.offsetWidth).toEqual(cell.nativeElement.offsetWidth);
1893+
const headerStyle = document.defaultView.getComputedStyle(header.nativeElement);
1894+
const paddingsAndBorders = parseFloat(headerStyle.paddingLeft) + parseFloat(headerStyle.paddingRight) +
1895+
parseFloat(headerStyle.borderRightWidth);
1896+
expect(header.nativeElement.offsetWidth).toEqual(Math.max(cell.nativeElement.offsetWidth, paddingsAndBorders));
18941897
expect(Number.isInteger(header.nativeElement.offsetWidth)).toBe(true);
18951898
}
18961899
});

0 commit comments

Comments
 (0)