Skip to content

Commit 3dc9373

Browse files
authored
Merge pull request #1532 from IgniteUI/VSlavov/selectAllRows-gridAPI-fix-1277-master
test(igx-grid): selectAllRows method properly selects rows, #1277
2 parents ad18063 + e73bc54 commit 3dc9373

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

projects/igniteui-angular/src/lib/grid/grid-selection.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,28 @@ describe('IgxGrid - Row Selection', () => {
917917
});
918918
}));
919919

920+
it('Should be able to correctly select all rows programatically', async(() => {
921+
const fixture = TestBed.createComponent(GridWithSelectionComponent);
922+
fixture.detectChanges();
923+
const grid = fixture.componentInstance.gridSelection3;
924+
const gridElement: HTMLElement = fixture.nativeElement.querySelector('.igx-grid');
925+
const firstRow = grid.getRowByIndex(0);
926+
const secondRow = grid.getRowByIndex(1);
927+
const firstRowCheckbox: HTMLElement = firstRow.nativeElement.querySelector('.igx-checkbox__input');
928+
expect(firstRow.isSelected).toBeFalsy();
929+
grid.selectAllRows();
930+
fixture.whenStable().then(() => {
931+
fixture.detectChanges();
932+
expect(firstRow.isSelected).toBeTruthy();
933+
expect(secondRow.isSelected).toBeTruthy();
934+
firstRowCheckbox.dispatchEvent(new Event('click', {}));
935+
return fixture.whenStable();
936+
}).then(() => {
937+
fixture.detectChanges();
938+
expect(firstRow.isSelected).toBeFalsy();
939+
});
940+
}));
941+
920942
it('Should be able to programatically select all rows with a correct reference, #1297', async(() => {
921943
const fix = TestBed.createComponent(GridWithPrimaryKeyComponent);
922944
fix.detectChanges();

0 commit comments

Comments
 (0)