@@ -58,19 +58,19 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
5858 expect ( hierarchicalGrid . columnList . filter ( col => col . columnGroup ) . length ) . toEqual ( expectedColumnGroups ) ;
5959 expect ( hierarchicalGrid . getColumnByName ( 'ProductName' ) . level ) . toEqual ( expectedLevel ) ;
6060
61- expect ( document . querySelectorAll ( 'igx-grid-header' ) . length ) . toEqual ( 3 ) ;
61+ expect ( GridFunctions . getColumnHeaders ( fixture ) . length ) . toEqual ( 3 ) ;
6262
6363 const firstRow = hierarchicalGrid . dataRowList . first ;
6464 // the first row's cell should contain an expand indicator
65- expect ( firstRow . nativeElement . children [ 0 ] . classList . contains ( 'igx-grid__hierarchical-expander' ) ) . toBeTruthy ( ) ;
65+ expect ( HierarchicalGridFunctions . hasExpander ( firstRow ) ) . toBeTruthy ( ) ;
6666 hierarchicalGrid . expandRow ( firstRow . rowID ) ;
6767
6868 const childGrid = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 0 ] ;
6969
7070 expect ( childGrid . columnList . filter ( col => col . columnGroup ) . length ) . toEqual ( expectedColumnGroups ) ;
7171 expect ( childGrid . getColumnByName ( 'ProductName' ) . level ) . toEqual ( expectedLevel ) ;
7272
73- expect ( document . querySelectorAll ( 'igx-grid-header' ) . length ) . toEqual ( 6 ) ;
73+ expect ( GridFunctions . getColumnHeaders ( fixture ) . length ) . toEqual ( 6 ) ;
7474 } ) ) ;
7575
7676 it ( 'should apply height correctly with and without filtering' , fakeAsync ( ( ) => {
@@ -235,7 +235,7 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
235235 childGrid . columnList . first . sortable = true ;
236236 fixture . detectChanges ( ) ;
237237
238- const childHeader = fixture . debugElement . query ( By . css ( 'igx-child-grid-row' ) ) . queryAll ( By . css ( 'igx-grid-header' ) ) [ 0 ] ;
238+ const childHeader = GridFunctions . getColumnHeader ( 'ID' , fixture , childGrid ) ;
239239 UIInteractions . simulateClickEvent ( childHeader . nativeElement ) ;
240240 fixture . detectChanges ( ) ;
241241 UIInteractions . simulateClickEvent ( childHeader . nativeElement ) ;
@@ -270,8 +270,7 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
270270 it ( 'should not lose child grid states after filtering in parent grid.' , fakeAsync ( ( ) => {
271271 // expand first row
272272 hierarchicalGrid . expandRow ( hierarchicalGrid . dataRowList . first . rowID ) ;
273- const childGrids = fixture . debugElement . queryAll ( By . css ( 'igx-child-grid-row' ) ) ;
274- let childGrid = childGrids [ 0 ] . query ( By . css ( 'igx-hierarchical-grid' ) ) . componentInstance ;
273+ let childGrid = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 0 ] ;
275274 let firstChildCell = childGrid . dataRowList . first . cells . first ;
276275 UIInteractions . simulateClickAndSelectCellEvent ( firstChildCell ) ;
277276 expect ( firstChildCell . selected ) . toBe ( true ) ;
@@ -282,7 +281,7 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
282281 expect ( ( hierarchicalGrid . getRowByIndex ( 0 ) as IgxHierarchicalRowComponent ) . expanded ) . toBe ( true ) ;
283282 expect ( hierarchicalGrid . getRowByIndex ( 1 ) instanceof IgxChildGridRowComponent ) . toBeTruthy ( ) ;
284283
285- childGrid = childGrids [ 0 ] . query ( By . css ( 'igx-hierarchical-grid' ) ) . componentInstance ;
284+ childGrid = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 0 ] ;
286285 firstChildCell = childGrid . dataRowList . first . cells . first ;
287286 expect ( firstChildCell . selected ) . toBe ( true ) ;
288287 } ) ) ;
@@ -305,17 +304,17 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
305304 it ( 'should apply classes to the header when filter row is visible' , fakeAsync ( ( ) => {
306305 hierarchicalGrid . rowSelection = GridSelectionMode . multiple ;
307306 fixture . detectChanges ( ) ;
308- const headerExpander : HTMLElement = fixture . nativeElement . querySelector ( '.igx-grid__hierarchical-expander' ) ;
309- const headerCheckbox : HTMLElement = fixture . nativeElement . querySelector ( '.igx-grid__cbx-selection' ) ;
307+ const headerExpander : HTMLElement = HierarchicalGridFunctions . getExpander ( fixture ) ;
308+ const headerCheckbox : HTMLElement = GridSelectionFunctions . getRowCheckboxDiv ( fixture . nativeElement ) ;
310309
311- expect ( headerExpander . classList . contains ( 'igx-grid__hierarchical-expander --push') ) . toBeFalsy ( ) ;
312- expect ( headerCheckbox . classList . contains ( 'igx-grid__cbx-selection --push') ) . toBeFalsy ( ) ;
310+ expect ( HierarchicalGridFunctions . isExpander ( headerExpander , ' --push') ) . toBeFalsy ( ) ;
311+ expect ( GridSelectionFunctions . isCheckbox ( headerCheckbox , ' --push') ) . toBeFalsy ( ) ;
313312
314313 // open filter row
315314 GridFunctions . clickFilterCellChipUI ( fixture , 'ID' ) ;
316315
317- expect ( headerExpander . classList . contains ( 'igx-grid__hierarchical-expander --push') ) . toBeTruthy ( ) ;
318- expect ( headerCheckbox . classList . contains ( 'igx-grid__cbx-selection --push') ) . toBeTruthy ( ) ;
316+ expect ( HierarchicalGridFunctions . isExpander ( headerExpander , ' --push') ) . toBeTruthy ( ) ;
317+ expect ( GridSelectionFunctions . isCheckbox ( headerCheckbox , ' --push') ) . toBeTruthy ( ) ;
319318 } ) ) ;
320319 } ) ;
321320
@@ -704,7 +703,7 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
704703 let childHeader = GridFunctions . getColumnGroupHeaders ( fixture ) [ 4 ] ;
705704 const firstHeaderIcon = childHeader . query ( By . css ( '.igx-icon' ) ) ;
706705
707- expect ( childHeader . nativeElement . classList ) . not . toContain ( 'igx-grid__th--pinned' ) ;
706+ expect ( GridFunctions . isHeaderPinned ( childHeader ) ) . toBeFalsy ( ) ;
708707 expect ( childGrid . columnList . first . pinned ) . toBeFalsy ( ) ;
709708 expect ( firstHeaderIcon ) . toBeDefined ( ) ;
710709
@@ -714,7 +713,7 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
714713
715714 childHeader = GridFunctions . getColumnGroupHeaders ( fixture ) [ 4 ] ;
716715 expect ( childGrid . columnList . first . pinned ) . toBeTruthy ( ) ;
717- expect ( childHeader . nativeElement . classList ) . toContain ( 'igx-grid__th--pinned' ) ;
716+ expect ( GridFunctions . isHeaderPinned ( childHeader ) ) . toBeTruthy ( ) ;
718717 } ) ) ;
719718
720719 it ( 'should be applied correctly for child grid with multi-column header.' , ( ( ) => {
@@ -731,13 +730,13 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
731730 expect ( childGrid . getRowByIndex ( 0 ) . cells . length ) . toBe ( 3 ) ;
732731 let cell = childGrid . getCellByColumn ( 0 , 'ChildLevels' ) ;
733732 expect ( cell . visibleColumnIndex ) . toEqual ( 0 ) ;
734- expect ( cell . nativeElement . classList ) . toContain ( 'igx-grid__td--pinned' ) ;
733+ expect ( GridFunctions . isCellPinned ( cell ) ) . toBeTruthy ( ) ;
735734 cell = childGrid . getCellByColumn ( 0 , 'ProductName' ) ;
736735 expect ( cell . visibleColumnIndex ) . toEqual ( 1 ) ;
737- expect ( cell . nativeElement . classList ) . toContain ( 'igx-grid__td--pinned' ) ;
736+ expect ( GridFunctions . isCellPinned ( cell ) ) . toBeTruthy ( ) ;
738737 cell = childGrid . getCellByColumn ( 0 , 'ID' ) ;
739738 expect ( cell . visibleColumnIndex ) . toEqual ( 2 ) ;
740- expect ( cell . nativeElement . classList ) . not . toContain ( 'igx-grid__td--pinned' ) ;
739+ expect ( GridFunctions . isCellPinned ( cell ) ) . toBeFalsy ( ) ;
741740 } ) ) ;
742741 } ) ;
743742} ) ;
0 commit comments