Skip to content

Commit d05a26e

Browse files
Vasil MihalkovVasil Mihalkov
Vasil Mihalkov
authored and
Vasil Mihalkov
committed
test(igxGrid): Fix test for groupBy #6640
1 parent 7885c6a commit d05a26e

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

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

+14-22
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ describe('Row Pinning #grid', () => {
218218
expect(grid.getRowByIndex(1).rowID).toBe(fix.componentInstance.data[1]);
219219
});
220220

221-
it('pinned rows and groupby.', () => {
221+
fit('pinned rows and groupby.', () => {
222222
// pin 1st and 2nd data row
223223
grid.pinRow(fix.componentInstance.data[0]);
224224
grid.pinRow(fix.componentInstance.data[1]);
@@ -230,32 +230,24 @@ describe('Row Pinning #grid', () => {
230230
});
231231
fix.detectChanges();
232232

233-
expect(grid.pinnedRecords.length).toBe(1);
234-
let pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
235-
expect(pinRowContainer.length).toBe(1);
236-
expect(pinRowContainer[0].children.length).toBe(1);
237-
expect(pinRowContainer[0].children[0].context.rowID).toBe(fix.componentInstance.data[1]);
238-
expect(pinRowContainer[0].children[0].nativeElement).toBe(grid.getRowByIndex(0).nativeElement);
233+
expect(grid.pinnedRecords.length).toBe(2);
239234

240-
expect(grid.getRowByIndex(1).rowID).toBe(fix.componentInstance.data[0]);
241-
expect(grid.getRowByIndex(2).rowID).toBe(fix.componentInstance.data[2]);
235+
// verify rows
236+
const groupRows = grid.groupsRowList.toArray();
237+
const dataRows = grid.dataRowList.toArray();
242238

243-
// pin 3rd data row
244-
grid.pinRow(fix.componentInstance.data[2]);
245-
fix.detectChanges();
239+
expect(groupRows.length).toEqual(2);
240+
expect(dataRows.length).toEqual(7);
241+
expect(groupRows[0].groupRow.records[0].ID).toEqual('AROUT');
246242

247-
pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
248-
expect(pinRowContainer[0].children.length).toBe(2);
249-
expect(pinRowContainer[0].children[0].context.rowID).toBe(fix.componentInstance.data[1]);
250-
expect(pinRowContainer[0].children[1].context.rowID).toBe(fix.componentInstance.data[2]);
243+
// pin 4th data row with ID:AROUT
244+
grid.pinRow(fix.componentInstance.data[3]);
245+
fix.detectChanges();
251246

252-
expect(grid.getRowByIndex(2).rowID).toBe(fix.componentInstance.data[0]);
253-
expect(grid.getRowByIndex(3).rowID).toBe(fix.componentInstance.data[3]);
247+
expect(grid.pinnedRecords.length).toBe(3);
254248

255-
// 2 records pinned + 2px border
256-
expect(grid.pinnedRowHeight).toBe(2 * grid.renderedRowHeight + 2);
257-
const expectedHeight = parseInt(grid.height, 10) - grid.pinnedRowHeight - 18 - grid.theadRow.nativeElement.offsetHeight;
258-
expect(grid.calcHeight - expectedHeight).toBeLessThanOrEqual(1);
249+
// make sure the pinned row is out of the first groupBy group
250+
expect(groupRows[0].groupRow.records[0].ID).toEqual('BLAUS');
259251
});
260252
});
261253
});

0 commit comments

Comments
 (0)