|
1 | 1 | import { async, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
2 | 2 | import { IgxTreeGridComponent } from './tree-grid.component';
|
| 3 | +import { SortingDirection } from '../../data-operations/sorting-expression.interface'; |
3 | 4 | import { IgxTreeGridModule, IgxTreeGridRowComponent } from './index';
|
4 | 5 | import {
|
5 | 6 | IgxTreeGridSimpleComponent, IgxTreeGridPrimaryForeignKeyComponent,
|
@@ -437,19 +438,32 @@ describe('IgxTreeGrid - Integration', () => {
|
437 | 438 | // Verify non-editable columns are skipped while navigating
|
438 | 439 | }));
|
439 | 440 |
|
440 |
| - it('updates are preserved after GroupBy is removed', fakeAsync(() => { |
441 |
| - // TODO |
442 |
| - // Test for parent and child nodes |
443 |
| - })); |
444 |
| - |
445 | 441 | it('updates are preserved after Filtering is removed', fakeAsync(() => {
|
446 | 442 | // TODO
|
447 | 443 | // Test for parent and child nodes
|
448 | 444 | }));
|
449 | 445 |
|
450 | 446 | 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'); |
453 | 467 | }));
|
454 | 468 | });
|
455 | 469 | });
|
0 commit comments