@@ -16,6 +16,7 @@ import {
16
16
IgxGridExternalAdvancedFilteringComponent ,
17
17
IgxGridAdvancedFilteringBindingComponent ,
18
18
IgxGridAdvancedFilteringDynamicColumnsComponent ,
19
+ IgxGridAdvancedFilteringSerializedTreeComponent ,
19
20
IgxGridAdvancedFilteringWithToolbarComponent
20
21
} from '../../test-utils/grid-samples.spec' ;
21
22
import { FormattedValuesFilteringStrategy } from '../../data-operations/filtering-strategy' ;
@@ -1450,6 +1451,52 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
1450
1451
// Verify no filtered data
1451
1452
expect ( grid . filteredData ) . toBe ( null ) ;
1452
1453
} ) ) ;
1454
+
1455
+ } ) ;
1456
+
1457
+ describe ( 'Expression tree rehydration - ' , ( ) => {
1458
+ it ( 'should correctly filter with a deserialized expression tree.' , fakeAsync ( ( ) => {
1459
+ const errorSpy = spyOn ( console , 'error' ) ;
1460
+ let fix = TestBed . createComponent ( IgxGridAdvancedFilteringSerializedTreeComponent ) ;
1461
+ fix . detectChanges ( ) ;
1462
+ let grid = fix . componentInstance . grid ;
1463
+
1464
+ expect ( errorSpy ) . not . toHaveBeenCalled ( ) ;
1465
+
1466
+ // Verify filtered data
1467
+ expect ( grid . filteredData . length ) . toEqual ( 3 ) ;
1468
+ expect ( grid . rowList . length ) . toBe ( 3 ) ;
1469
+ } ) ) ;
1470
+
1471
+ it ( 'should correctly filter with a declared IFilteringExpressionsTree object.' , fakeAsync ( ( ) => {
1472
+ const errorSpy = spyOn ( console , 'error' ) ;
1473
+ let fix = TestBed . createComponent ( IgxGridAdvancedFilteringSerializedTreeComponent ) ;
1474
+ fix . detectChanges ( ) ;
1475
+ fix . componentInstance . grid . advancedFilteringExpressionsTree = fix . componentInstance . filterTreeObject ;
1476
+ fix . detectChanges ( ) ;
1477
+ let grid = fix . componentInstance . grid ;
1478
+
1479
+ expect ( errorSpy ) . not . toHaveBeenCalled ( ) ;
1480
+
1481
+ // Verify filtered data
1482
+ expect ( grid . filteredData . length ) . toEqual ( 2 ) ;
1483
+ expect ( grid . rowList . length ) . toBe ( 2 ) ;
1484
+ } ) ) ;
1485
+
1486
+ it ( 'should correctly filter when binding to a declared IFilteringExpressionsTree object.' , fakeAsync ( ( ) => {
1487
+ const errorSpy = spyOn ( console , 'error' ) ;
1488
+ let fix = TestBed . createComponent ( IgxGridAdvancedFilteringSerializedTreeComponent ) ;
1489
+ fix . detectChanges ( ) ;
1490
+ fix . componentInstance . filterTree = fix . componentInstance . filterTreeObject ;
1491
+ fix . detectChanges ( ) ;
1492
+ let grid = fix . componentInstance . grid ;
1493
+
1494
+ expect ( errorSpy ) . not . toHaveBeenCalled ( ) ;
1495
+
1496
+ // Verify filtered data
1497
+ expect ( grid . filteredData . length ) . toEqual ( 2 ) ;
1498
+ expect ( grid . rowList . length ) . toBe ( 2 ) ;
1499
+ } ) ) ;
1453
1500
} ) ;
1454
1501
} ) ;
1455
1502
0 commit comments