Skip to content

Commit f030eb2

Browse files
authored
Merge pull request #5567 from IgniteUI/SKrastev/fix-mrl-tests-8.1.x
Update evaluating of 'grid-template-rows' style to reflect how chrome 76 sets it now.
2 parents a1fb095 + f4db295 commit f030eb2

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

projects/igniteui-angular/src/lib/core/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export const enum KEYS {
170170
*/
171171
export function getNodeSizeViaRange(range: Range, node: any): number {
172172
let overflow = null;
173-
if (isIE() || isEdge()) {
173+
if (!isFirefox()) {
174174
overflow = node.style.overflow;
175175
// we need that hack - otherwise content won't be measured correctly in IE/Edge
176176
node.style.overflow = 'visible';
@@ -179,7 +179,7 @@ export function getNodeSizeViaRange(range: Range, node: any): number {
179179
range.selectNodeContents(node);
180180
const width = range.getBoundingClientRect().width;
181181

182-
if (isIE() || isEdge()) {
182+
if (!isFirefox()) {
183183
// we need that hack - otherwise content won't be measured correctly in IE/Edge
184184
node.style.overflow = overflow;
185185
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,8 @@ describe('IgxGrid - Deferred Column Resizing', () => {
687687

688688
column.autosize();
689689
fixture.detectChanges();
690-
expect(column.width).toEqual('119px');
690+
// the exact width is different between chrome and chrome headless so an exact match is erroneous
691+
expect(Math.abs(parseInt(column.width, 10) - 120)).toBeLessThan(2);
691692

692693
// height/width setter rAF
693694
await wait(16);

projects/igniteui-angular/src/lib/grids/grid/grid.multi-row-layout.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ describe('IgxGrid - multi-row-layout', () => {
166166
verifyLayoutHeadersAreAligned(headerCells, firstRowCells);
167167

168168
// verify block style
169-
let groupHeaderBlocks = fixture.debugElement.query(By.css('.igx-grid__thead')).queryAll(By.css(GRID_MRL_BLOCK));
170-
expect(groupHeaderBlocks[0].nativeElement.style.gridTemplateColumns).toBe('200px 200px 200px');
171-
expect(groupHeaderBlocks[0].nativeElement.style.gridTemplateRows).toBe('1fr 1fr 1fr');
169+
expect(grid.columnList.first.getGridTemplate(false, false)).toBe('200px 200px 200px');
170+
expect(grid.columnList.first.getGridTemplate(true, false)).toBe('repeat(3,1fr)');
172171

173172
// creating an incomplete layout 2
174173
fixture.componentInstance.colGroups = [{
@@ -183,9 +182,8 @@ describe('IgxGrid - multi-row-layout', () => {
183182
fixture.componentInstance.grid.width = '617px';
184183
fixture.detectChanges();
185184

186-
groupHeaderBlocks = fixture.debugElement.query(By.css('.igx-grid__thead')).queryAll(By.css(GRID_MRL_BLOCK));
187-
expect(groupHeaderBlocks[0].nativeElement.style.gridTemplateColumns).toBe('200px 200px 200px');
188-
expect(groupHeaderBlocks[0].nativeElement.style.gridTemplateRows).toBe('1fr 1fr 1fr');
185+
expect(grid.columnList.first.getGridTemplate(false, false)).toBe('200px 200px 200px');
186+
expect(grid.columnList.first.getGridTemplate(true, false)).toBe('repeat(3,1fr)');
189187

190188
});
191189
it('should initialize correctly when no column widths are set.', () => {
@@ -854,14 +852,16 @@ describe('IgxGrid - multi-row-layout', () => {
854852

855853
// check first group has height of 2 row spans in header and rows but the header itself should span 1 row
856854
// check group block and column header height
857-
const groupHeaderBlocks = fixture.debugElement.query(By.css('.igx-grid__thead')).queryAll(By.css(GRID_MRL_BLOCK));
855+
const firstLayout = grid.columnList.toArray()[0];
858856
expect(grid.multiRowLayoutRowSize).toEqual(2);
859-
expect(groupHeaderBlocks[0].nativeElement.style.gridTemplateRows).toEqual('1fr 1fr');
860-
expect(groupHeaderBlocks[0].nativeElement.offsetHeight).toBe((grid.rowHeight + 1) * 2);
857+
expect(firstLayout.getGridTemplate(true, false)).toEqual('repeat(2,1fr)');
858+
expect(firstLayout.headerGroup.element.nativeElement.offsetHeight).toBe((grid.rowHeight + 1) * 2);
861859
expect(grid.getColumnByName('Fax').headerCell.elementRef.nativeElement.offsetHeight).toBe(grid.rowHeight + 1);
862860

863-
expect(groupHeaderBlocks[1].nativeElement.style.gridTemplateRows).toEqual('1fr 1fr');
864-
expect(groupHeaderBlocks[1].nativeElement.offsetHeight).toBe((grid.rowHeight + 1) * 2);
861+
const secondLayout = grid.columnList.toArray()[2];
862+
const contactNameColumn = grid.getColumnByName('ContactName');
863+
expect(contactNameColumn.getGridTemplate(true, false)).toEqual('repeat(2,1fr)');
864+
expect(secondLayout.headerGroup.element.nativeElement.offsetHeight).toBe((grid.rowHeight + 1) * 2);
865865

866866
// check cell height in row. By default should span 1 row
867867
const firstCell = grid.getCellByColumn(0, 'Fax').nativeElement;

0 commit comments

Comments
 (0)