@@ -13,6 +13,7 @@ import { DisplayDensity } from '../../core/displayDensity';
13
13
import { IgxStringFilteringOperand } from '../../data-operations/filtering-condition' ;
14
14
import { IGridCellEventArgs } from '../grid/public_api' ;
15
15
import { GridSelectionMode } from '../common/enums' ;
16
+ import { GridFunctions } from '../../test-utils/grid-functions.spec' ;
16
17
17
18
describe ( 'Basic IgxHierarchicalGrid #hGrid' , ( ) => {
18
19
configureTestSuite ( ) ;
@@ -1206,25 +1207,24 @@ describe('IgxHierarchicalGrid Runtime Row Island change Scenarios #hGrid', () =>
1206
1207
1207
1208
describe ( 'IgxHierarchicalGrid custom template #hGrid' , ( ) => {
1208
1209
configureTestSuite ( ) ;
1209
- let fixture : ComponentFixture < IgxHierarchicalGridCustomTemplateComponent > ;
1210
- let hierarchicalGrid : IgxHierarchicalGridComponent ;
1210
+
1211
1211
beforeAll ( waitForAsync ( ( ) => {
1212
1212
TestBed . configureTestingModule ( {
1213
1213
declarations : [
1214
- IgxHierarchicalGridCustomTemplateComponent
1214
+ IgxHierarchicalGridCustomTemplateComponent ,
1215
+ IgxHierarchicalGridCustomFilteringTemplateComponent ,
1215
1216
] ,
1216
1217
imports : [
1217
1218
NoopAnimationsModule , IgxHierarchicalGridModule ]
1218
1219
} ) . compileComponents ( ) ;
1219
1220
} ) ) ;
1220
1221
1221
- beforeEach ( fakeAsync ( ( ) => {
1222
- fixture = TestBed . createComponent ( IgxHierarchicalGridCustomTemplateComponent ) ;
1222
+ it ( 'should allow setting custom template for expand/collapse icons' , async ( ) => {
1223
+ const fixture = TestBed . createComponent ( IgxHierarchicalGridCustomTemplateComponent ) ;
1223
1224
fixture . detectChanges ( ) ;
1224
- hierarchicalGrid = fixture . componentInstance . hgrid ;
1225
- } ) ) ;
1226
1225
1227
- it ( ' should allow setting custom template for expand/collapse icons' , async ( ) => {
1226
+ const hierarchicalGrid = fixture . componentInstance . hgrid ;
1227
+
1228
1228
let rows = hierarchicalGrid . dataRowList . toArray ( ) ;
1229
1229
for ( const row of rows ) {
1230
1230
const expander = row . nativeElement . querySelector ( '.igx-grid__hierarchical-expander' ) ;
@@ -1257,6 +1257,36 @@ describe('IgxHierarchicalGrid custom template #hGrid', () => {
1257
1257
fixture . detectChanges ( ) ;
1258
1258
expect ( ( hierarchicalGrid as any ) . headerHierarchyExpander . nativeElement . innerText ) . toBe ( 'COLLAPSED' ) ;
1259
1259
} ) ;
1260
+
1261
+ it ( 'should correctly filter templated row island in hierarchical grid' , fakeAsync ( ( ) => {
1262
+ const fixture = TestBed . createComponent ( IgxHierarchicalGridCustomFilteringTemplateComponent ) ;
1263
+ fixture . detectChanges ( ) ;
1264
+
1265
+ const hierarchicalGrid = fixture . componentInstance . hgrid ;
1266
+ const firstRow = hierarchicalGrid . getRowByIndex ( 0 ) as IgxHierarchicalRowComponent ;
1267
+ UIInteractions . simulateClickAndSelectEvent ( firstRow . expander ) ;
1268
+ fixture . detectChanges ( ) ;
1269
+
1270
+ GridFunctions . clickExcelFilterIconFromCode ( fixture , hierarchicalGrid , 'ProductName' ) ;
1271
+ tick ( 200 ) ;
1272
+ fixture . detectChanges ( ) ;
1273
+
1274
+ const searchComponent = GridFunctions . getExcelStyleSearchComponent ( fixture , null , 'igx-hierarchical-grid' ) ;
1275
+ const inputNativeElement = GridFunctions . getExcelStyleSearchComponentInput ( fixture , searchComponent , 'igx-hierarchical-grid' ) ;
1276
+ UIInteractions . clickAndSendInputElementValue ( inputNativeElement , 'A4' , fixture ) ;
1277
+ tick ( 100 ) ;
1278
+ fixture . detectChanges ( ) ;
1279
+
1280
+ GridFunctions . clickApplyExcelStyleFiltering ( fixture , null , 'igx-hierarchical-grid' ) ;
1281
+ tick ( 100 ) ;
1282
+ fixture . detectChanges ( ) ;
1283
+
1284
+ const gridCellValues = GridFunctions . getColumnCells ( fixture , 'ProductName' , 'igx-hierarchical-grid-cell' )
1285
+ . map ( c => c . nativeElement . innerText )
1286
+ . sort ( ) ;
1287
+
1288
+ expect ( gridCellValues . length ) . toBe ( 1 ) ;
1289
+ } ) ) ;
1260
1290
} ) ;
1261
1291
1262
1292
@Component ( {
@@ -1490,3 +1520,47 @@ public toggleChildRI = true;
1490
1520
} )
1491
1521
export class IgxHierarchicalGridCustomTemplateComponent extends IgxHierarchicalGridTestBaseComponent { }
1492
1522
1523
+ @Component ( {
1524
+ template : `
1525
+ <igx-hierarchical-grid #grid1 [data]="data" [showExpandAll]='true'
1526
+ [autoGenerate]="false" [height]="'400px'" [width]="width" [allowFiltering]='true' filterMode="excelStyleFilter" #hierarchicalGrid>
1527
+ <igx-column field="ID"></igx-column>
1528
+ <igx-column field="ProductName"></igx-column>
1529
+ <igx-row-island [showExpandAll]='true' [key]="'childData'" [autoGenerate]="false"
1530
+ [allowFiltering]='true' filterMode="excelStyleFilter" #rowIsland>
1531
+ <ng-template igxExcelStyleHeaderIcon>
1532
+ <igx-icon>filter_alt</igx-icon>
1533
+ </ng-template>
1534
+ <igx-grid-excel-style-filtering [minHeight]="'280px'" [maxHeight]="'300px'">
1535
+ <igx-excel-style-column-operations>
1536
+ <igx-excel-style-header
1537
+ [showPinning]="true"
1538
+ [showHiding]="true"
1539
+ >
1540
+ </igx-excel-style-header>
1541
+ <igx-excel-style-sorting></igx-excel-style-sorting>
1542
+ </igx-excel-style-column-operations>
1543
+ <igx-excel-style-filter-operations>
1544
+ <igx-excel-style-search></igx-excel-style-search>
1545
+ </igx-excel-style-filter-operations>
1546
+ </igx-grid-excel-style-filtering>
1547
+ <igx-column field="ID"></igx-column>
1548
+ <igx-column field="ProductName"></igx-column>
1549
+ <igx-row-island [key]="'childData'" [autoGenerate]="true" #rowIsland2 >
1550
+ </igx-row-island>
1551
+ </igx-row-island>
1552
+ <ng-template igxRowExpandedIndicator>
1553
+ <span>EXPANDED</span>
1554
+ </ng-template>
1555
+ <ng-template igxRowCollapsedIndicator>
1556
+ <span>COLLAPSED</span>
1557
+ </ng-template>
1558
+ <ng-template igxHeaderCollapsedIndicator>
1559
+ <span>COLLAPSED</span>
1560
+ </ng-template>
1561
+ <ng-template igxHeaderExpandedIndicator>
1562
+ <span>EXPANDED</span>
1563
+ </ng-template>
1564
+ </igx-hierarchical-grid>`
1565
+ } )
1566
+ export class IgxHierarchicalGridCustomFilteringTemplateComponent extends IgxHierarchicalGridTestBaseComponent { }
0 commit comments