Skip to content

Commit fca486c

Browse files
committed
test(igxTreeGrid): Adds filtering and sorting tests for treeGrid rp #6640
1 parent 65accf9 commit fca486c

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

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

+30-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { UIInteractions, wait } from '../../test-utils/ui-interactions.spec';
1717
import { By } from '@angular/platform-browser';
1818
import { configureTestSuite } from '../../test-utils/configure-suite';
1919
import { IgxToggleModule } from '../../directives/toggle/toggle.directive';
20-
import { IgxNumberFilteringOperand } from '../../data-operations/filtering-condition';
20+
import { IgxNumberFilteringOperand, IgxStringFilteringOperand } from '../../data-operations/filtering-condition';
2121
import { IgxHierarchicalTransactionService } from '../../services/transaction/igx-hierarchical-transaction';
2222
import { IgxGridTransaction } from '../grid-base.directive';
2323
import { IgxGridCellComponent } from '../grid';
@@ -1525,9 +1525,36 @@ describe('IgxTreeGrid - Integration #tGrid', () => {
15251525
expect(searchResultsCount).toBe(2);
15261526
});
15271527

1528-
it('should apply filtering to both pinned and unpinned rows', () => {});
1528+
it('should apply filtering to both pinned and unpinned rows', () => {
1529+
treeGrid.pinRow(147);
1530+
treeGrid.pinRow(711);
1531+
fix.detectChanges();
1532+
1533+
treeGrid.filter('ID', 147, IgxStringFilteringOperand.instance().condition('contains'), false);
1534+
fix.detectChanges();
1535+
1536+
const gridFilterData = treeGrid.filteredData;
1537+
expect(gridFilterData.length).toBe(2);
1538+
expect(gridFilterData[0].ID).toBe(147);
1539+
expect(gridFilterData[1].recordRef.ID).toBe(147);
1540+
});
1541+
1542+
it('should apply sorting to both pinned and unpinned rows', () => {
1543+
treeGrid.pinRow(147);
1544+
treeGrid.pinRow(711);
1545+
fix.detectChanges();
15291546

1530-
it('should apply sorting to both pinned and unpinned rows', () => {});
1547+
expect(treeGrid.getRowByIndex(0).rowID).toBe(147);
1548+
expect(treeGrid.getRowByIndex(1).rowID).toBe(711);
1549+
expect(treeGrid.getRowByIndex(2).rowID).toBe(147);
1550+
1551+
treeGrid.sort({ fieldName: 'ID', dir: SortingDirection.Desc, ignoreCase: false });
1552+
fix.detectChanges();
1553+
1554+
expect(treeGrid.getRowByIndex(0).rowID).toBe(711);
1555+
expect(treeGrid.getRowByIndex(1).rowID).toBe(147);
1556+
expect(treeGrid.getRowByIndex(2).rowID).toBe(847);
1557+
});
15311558

15321559
it('should not take into account pinned rows when changing items per page', () => {});
15331560

0 commit comments

Comments
 (0)