1- import { TestBed , waitForAsync } from '@angular/core/testing' ;
1+ import { fakeAsync , TestBed , tick , waitForAsync } from '@angular/core/testing' ;
22import { Component , ViewChild } from '@angular/core' ;
33import { IgxGridStateDirective , IGridState , IColumnState } from './state.directive' ;
44import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
@@ -169,7 +169,7 @@ describe('IgxHierarchicalGridState - input properties #hGrid', () => {
169169 HelperFunctions . verifyFilteringExpressions ( filtering , gridState ) ;
170170 } ) ;
171171
172- it ( 'setState should correctly restore grid filtering state from string' , ( ) => {
172+ it ( 'setState should correctly restore grid filtering state from string' , fakeAsync ( ( ) => {
173173 const state = fix . componentInstance . state ;
174174
175175 const emptyFiltering = '{"filteringOperands":[],"operator":0}' ;
@@ -185,6 +185,8 @@ describe('IgxHierarchicalGridState - input properties #hGrid', () => {
185185 expect ( gridState ) . toBe ( initialState ) ;
186186
187187 state . setState ( JSON . stringify ( filteringStateObject ) ) ;
188+ tick ( ) ;
189+ fix . detectChanges ( ) ;
188190 gridState = state . getState ( false , [ 'filtering' , 'rowIslands' ] ) as IGridState ;
189191 HelperFunctions . verifyFilteringExpressions ( grid . filteringExpressionsTree , gridState ) ;
190192 const gridsCollection = HelperFunctions . getChildGridsCollection ( grid , gridState ) ;
@@ -193,9 +195,9 @@ describe('IgxHierarchicalGridState - input properties #hGrid', () => {
193195 } ) ;
194196 gridState = state . getState ( true , [ 'filtering' , 'rowIslands' ] ) ;
195197 expect ( gridState ) . toBe ( filteringState ) ;
196- } ) ;
198+ } ) ) ;
197199
198- it ( 'setState should correctly restore grid filtering state from object' , ( ) => {
200+ it ( 'setState should correctly restore grid filtering state from object' , fakeAsync ( ( ) => {
199201 const state = fix . componentInstance . state ;
200202
201203 const emptyFiltering = '{"filteringOperands":[],"operator":0}' ;
@@ -211,6 +213,8 @@ describe('IgxHierarchicalGridState - input properties #hGrid', () => {
211213 expect ( gridState ) . toBe ( initialState ) ;
212214
213215 state . setState ( filteringStateObject ) ;
216+ tick ( ) ;
217+ fix . detectChanges ( ) ;
214218 gridState = state . getState ( false , [ 'filtering' , 'rowIslands' ] ) as IGridState ;
215219 HelperFunctions . verifyFilteringExpressions ( grid . filteringExpressionsTree , gridState ) ;
216220 const gridsCollection = HelperFunctions . getChildGridsCollection ( grid , gridState ) ;
@@ -219,7 +223,7 @@ describe('IgxHierarchicalGridState - input properties #hGrid', () => {
219223 } ) ;
220224 gridState = state . getState ( true , [ 'filtering' , 'rowIslands' ] ) ;
221225 expect ( gridState ) . toBe ( filteringState ) ;
222- } ) ;
226+ } ) ) ;
223227
224228 it ( 'setState should correctly restore grid sorting state from string' , ( ) => {
225229 const state = fix . componentInstance . state ;
0 commit comments