@@ -1685,15 +1685,80 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
16851685
16861686 // Check for error messages in the console
16871687 expect ( consoleSpy ) . not . toHaveBeenCalled ( ) ;
1688+ expect ( hgrid . filteredData . length ) . toBe ( 13 ) ;
16881689 } ) ) ;
16891690
1690- // fit('Should be able to filter hierarchicaly with load on demand through API.', fakeAsync(() => {
1691- // const fixture = TestBed.createComponent(IgxHGridRemoteOnDemandComponent);
1692- // const hierarchicalGrid = fixture.componentInstance.hgrid;
1693- // hierarchicalGrid.allowAdvancedFiltering = true;
1694- // fixture.detectChanges();
1691+ it ( 'Should have proper fields in UI when schema is defined with load on demand.' , fakeAsync ( ( ) => {
1692+ const fixture = TestBed . createComponent ( IgxHGridRemoteOnDemandComponent ) ;
1693+ const hierarchicalGrid = fixture . componentInstance . instance ;
1694+ hierarchicalGrid . allowAdvancedFiltering = true ;
1695+ hierarchicalGrid . schema = [
1696+ {
1697+ name : 'rootLevel' ,
1698+ fields : [
1699+ { field : 'ID' , dataType : 'string' } ,
1700+ { field : 'ChildLevels' , dataType : 'number' } ,
1701+ { field : 'ProductName' , dataType : 'string' } ,
1702+ { field : 'Col1' , dataType : 'number' } ,
1703+ { field : 'Col2' , dataType : 'number' } ,
1704+ { field : 'Col3' , dataType : 'number' }
1705+ ] ,
1706+ childEntities : [
1707+ {
1708+ name : 'childData' ,
1709+ fields : [
1710+ { field : 'ID' , dataType : 'string' } ,
1711+ { field : 'ProductName' , dataType : 'string' }
1712+ ] ,
1713+ childEntities : [
1714+ {
1715+ name : 'childData2' ,
1716+ fields : [
1717+ { field : 'ID' , dataType : 'string' } ,
1718+ { field : 'ProductName' , dataType : 'string' }
1719+ ]
1720+ }
1721+ ]
1722+ }
1723+ ]
1724+ }
1725+ ]
1726+ fixture . detectChanges ( ) ;
1727+
1728+ hierarchicalGrid . openAdvancedFilteringDialog ( ) ;
1729+ fixture . detectChanges ( ) ;
16951730
1696- // }));
1731+ // Click the initial 'Add Condition' button.
1732+ QueryBuilderFunctions . clickQueryBuilderInitialAddConditionBtn ( fixture , 0 ) ;
1733+ tick ( 100 ) ;
1734+ fixture . detectChanges ( ) ;
1735+ // Populate edit inputs.
1736+ QueryBuilderFunctions . selectColumnInEditModeExpression ( fixture , 0 ) ; // Select 'ID' column.
1737+ QueryBuilderFunctions . selectOperatorInEditModeExpression ( fixture , 10 ) ; // Select 'In' operator.
1738+ tick ( 100 ) ;
1739+ fixture . detectChanges ( ) ;
1740+
1741+ const entityInputGroup = QueryBuilderFunctions . getQueryBuilderEntitySelect ( fixture , 1 ) . querySelector ( 'input' ) ;
1742+ expect ( entityInputGroup . value ) . toBe ( 'childData' ) ;
1743+
1744+ const fieldInputGroup = QueryBuilderFunctions . getQueryBuilderFieldsCombo ( fixture , 1 ) . querySelector ( 'input' ) ;
1745+ expect ( fieldInputGroup . value ) . toBe ( 'ID' ) ;
1746+
1747+ // Verify entities
1748+ QueryBuilderFunctions . clickQueryBuilderEntitySelect ( fixture , 1 ) ;
1749+ fixture . detectChanges ( ) ;
1750+ const queryBuilderElement : HTMLElement = fixture . debugElement . queryAll ( By . css ( `.${ QueryBuilderSelectors . QUERY_BUILDER_TREE } ` ) ) [ 1 ] . nativeElement ;
1751+ let dropdownValues : string [ ] = QueryBuilderFunctions . getQueryBuilderSelectDropdownItems ( queryBuilderElement ) . map ( ( x : any ) => x . innerText ) ;
1752+ let expectedValues = [ 'childData' ] ;
1753+ expect ( dropdownValues ) . toEqual ( expectedValues ) ;
1754+
1755+ // Verify return fileds
1756+ QueryBuilderFunctions . clickQueryBuilderFieldsCombo ( fixture , 1 ) ;
1757+ fixture . detectChanges ( ) ;
1758+ dropdownValues = QueryBuilderFunctions . getQueryBuilderSelectDropdownItems ( queryBuilderElement , 1 ) . map ( ( x : any ) => x . innerText ) ;
1759+ expectedValues = [ 'ID' , 'ProductName' ] ;
1760+ expect ( dropdownValues ) . toEqual ( expectedValues ) ;
1761+ } ) ) ;
16971762 } ) ;
16981763} ) ;
16991764
0 commit comments