Skip to content

Commit 1a2be8e

Browse files
committed
test(roe editing): Adding tests for row editing + Sorting #2530
1 parent 20ce5e8 commit 1a2be8e

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

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

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { async, fakeAsync, TestBed, tick } from '@angular/core/testing';
22
import { IgxTreeGridComponent } from './tree-grid.component';
3+
import { SortingDirection } from '../../data-operations/sorting-expression.interface';
34
import { IgxTreeGridModule, IgxTreeGridRowComponent } from './index';
45
import {
56
IgxTreeGridSimpleComponent, IgxTreeGridPrimaryForeignKeyComponent,
@@ -437,19 +438,32 @@ describe('IgxTreeGrid - Integration', () => {
437438
// Verify non-editable columns are skipped while navigating
438439
}));
439440

440-
it('updates are preserved after GroupBy is removed', fakeAsync(() => {
441-
// TODO
442-
// Test for parent and child nodes
443-
}));
444-
445441
it('updates are preserved after Filtering is removed', fakeAsync(() => {
446442
// TODO
447443
// Test for parent and child nodes
448444
}));
449445

450446
it('updates are preserved after Sorting is removed', fakeAsync(() => {
451-
// TODO
452-
// Test for parent and child nodes
447+
treeGrid.sort({ fieldName: 'Name', dir: SortingDirection.Asc, ignoreCase: false });
448+
fix.detectChanges();
449+
450+
// Verify first level records are desc sorted
451+
expect(treeGrid.getCellByColumn(0, 'Name').value).toEqual('Ana Sanders');
452+
expect(treeGrid.getCellByColumn(1, 'Name').value).toEqual('Elizabeth Richards');
453+
expect(treeGrid.getCellByColumn(8, 'Name').value).toEqual('Thomas Hardy');
454+
455+
const targetCell = treeGrid.getCellByColumn(1, 'Name');
456+
targetCell.update('Bojidar Kraev');
457+
tick();
458+
fix.detectChanges();
459+
460+
expect(treeGrid.getCellByColumn(1, 'Name').value).toEqual('Bojidar Kraev');
461+
462+
treeGrid.clearSort();
463+
fix.detectChanges();
464+
expect(treeGrid.getCellByColumn(9, 'Name').value).toEqual('Bojidar Kraev');
465+
expect(treeGrid.getCellByColumn(8, 'Name').value).toEqual('Ana Sanders');
466+
expect(treeGrid.getCellByColumn(1, 'Name').value).toEqual('Michael Langdon');
453467
}));
454468
});
455469
});

0 commit comments

Comments
 (0)