@@ -1520,7 +1520,7 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
15201520 fix . detectChanges ( ) ;
15211521 } ) ) ;
15221522
1523- it ( `Should NOT have 'In'/'Not-In' operators for not chilld entities fields .` , fakeAsync ( ( ) => {
1523+ it ( `Should have 'In'/'Not-In' operators for fields with chilld entities.` , fakeAsync ( ( ) => {
15241524 // Populate edit inputs.
15251525 QueryBuilderFunctions . selectColumnInEditModeExpression ( fix , 0 ) ; // Select 'ID' column.
15261526
@@ -1530,7 +1530,7 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
15301530 const queryBuilderElement : HTMLElement = fix . debugElement . queryAll ( By . css ( `.${ QueryBuilderSelectors . QUERY_BUILDER_TREE } ` ) ) [ 0 ] . nativeElement ;
15311531 const dropdownValues : string [ ] = QueryBuilderFunctions . getQueryBuilderSelectDropdownItems ( queryBuilderElement ) . map ( ( x : any ) => x . innerText ) ;
15321532 const expectedValues = [ 'Contains' , 'Does Not Contain' , 'Starts With' , 'Ends With' , 'Equals' ,
1533- 'Does Not Equal' , 'Empty' , 'Not Empty' , 'Null' , 'Not Null' ] ; ;
1533+ 'Does Not Equal' , 'Empty' , 'Not Empty' , 'Null' , 'Not Null' , 'In' , 'Not In' ] ; ;
15341534 expect ( dropdownValues ) . toEqual ( expectedValues ) ;
15351535
15361536 // Close Advanced Filtering dialog.
@@ -1539,30 +1539,66 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
15391539 fix . detectChanges ( ) ;
15401540 } ) ) ;
15411541
1542- it ( `Should have 'In'/'Not-In' operators for chilld entities fields .` , fakeAsync ( ( ) => {
1542+ it ( `Should NOT have 'In'/'Not-In' operators for fields without chilld entities.` , fakeAsync ( ( ) => {
15431543 // Populate edit inputs.
1544- QueryBuilderFunctions . selectColumnInEditModeExpression ( fix , 3 ) ; // Select 'Child Data'.
1544+ QueryBuilderFunctions . selectColumnInEditModeExpression ( fix , 0 ) ; // Select 'ID' column.
1545+ QueryBuilderFunctions . selectOperatorInEditModeExpression ( fix , 10 ) ; // Select 'In' operator.
15451546
1546- // Open the operator dropdown and verify they are only 'In'/'Not In'.
1547- QueryBuilderFunctions . clickQueryBuilderOperatorSelect ( fix ) ;
1547+ // Select entity in nested level
1548+ QueryBuilderFunctions . selectEntityAndClickInitialAddCondition ( fix , 0 , 1 ) ;
1549+ // Populate edit inputs on level 1.
1550+ QueryBuilderFunctions . selectColumnInEditModeExpression ( fix , 0 , 1 ) ; // Select 'ID' column.
1551+ QueryBuilderFunctions . selectOperatorInEditModeExpression ( fix , 11 , 1 ) ; // Select 'Not In' operator.
1552+
1553+ // Select entity in nested level
1554+ QueryBuilderFunctions . selectEntityAndClickInitialAddCondition ( fix , 0 , 2 ) ;
1555+ QueryBuilderFunctions . selectColumnInEditModeExpression ( fix , 0 , 2 ) ; // Select 'ID' column.
1556+ // Open the operator dropdown and verify they are 'string' specific + 'In'/'Not In'.
1557+ QueryBuilderFunctions . clickQueryBuilderOperatorSelect ( fix , 2 ) ;
15481558 fix . detectChanges ( ) ;
1549- const queryBuilderElement : HTMLElement = fix . debugElement . queryAll ( By . css ( `.${ QueryBuilderSelectors . QUERY_BUILDER_TREE } ` ) ) [ 0 ] . nativeElement ;
1559+ const queryBuilderElement : HTMLElement = fix . debugElement . queryAll ( By . css ( `.${ QueryBuilderSelectors . QUERY_BUILDER_TREE } ` ) ) [ 2 ] . nativeElement ;
15501560 const dropdownValues : string [ ] = QueryBuilderFunctions . getQueryBuilderSelectDropdownItems ( queryBuilderElement ) . map ( ( x : any ) => x . innerText ) ;
1551- const expectedValues = [ 'In' , 'Not In' ] ; ;
1561+ const expectedValues = [ 'Contains' , 'Does Not Contain' , 'Starts With' , 'Ends With' , 'Equals' ,
1562+ 'Does Not Equal' , 'Empty' , 'Not Empty' , 'Null' , 'Not Null' ] ; ;
15521563 expect ( dropdownValues ) . toEqual ( expectedValues ) ;
15531564
15541565 // Close Advanced Filtering dialog.
15551566 hgrid . closeAdvancedFilteringDialog ( false ) ;
15561567 tick ( 200 ) ;
1568+ fix . detectChanges ( ) ;
1569+ } ) ) ;
1570+
1571+ it ( 'Should have correct entities depending on the hierarchy level.' , fakeAsync ( ( ) => {
1572+ // Populate edit inputs.
1573+ QueryBuilderFunctions . selectColumnInEditModeExpression ( fix , 0 ) ; // Select 'ID' column.
1574+ QueryBuilderFunctions . selectOperatorInEditModeExpression ( fix , 10 ) ; // Select 'In' operator.
1575+
1576+ QueryBuilderFunctions . clickQueryBuilderEntitySelect ( fix , 1 ) ;
15571577 fix . detectChanges ( ) ;
1578+ const queryBuilderElement : HTMLElement = fix . debugElement . queryAll ( By . css ( `.${ QueryBuilderSelectors . QUERY_BUILDER_TREE } ` ) ) [ 1 ] . nativeElement ;
1579+ const dropdownValues : string [ ] = QueryBuilderFunctions . getQueryBuilderSelectDropdownItems ( queryBuilderElement ) . map ( ( x : any ) => x . innerText ) ;
1580+ const expectedValues = [ 'childData' ] ;
1581+ expect ( dropdownValues ) . toEqual ( expectedValues ) ;
1582+
1583+ // Close Advanced Filtering dialog.
1584+ hgrid . closeAdvancedFilteringDialog ( false ) ;
1585+ tick ( 200 ) ;
1586+ fix . detectChanges ( ) ;
15581587 } ) ) ;
15591588
15601589 it ( `Should apply 'In'/'Not-In' operators for each level properly.` , fakeAsync ( ( ) => {
15611590 // Populate edit inputs.
1562- QueryBuilderFunctions . selectColumnInEditModeExpression ( fix , 3 ) ; // Select 'childData' entity .
1563- QueryBuilderFunctions . selectOperatorInEditModeExpression ( fix , 0 ) ; // Select 'In' operator.
1591+ QueryBuilderFunctions . selectColumnInEditModeExpression ( fix , 0 ) ; // Select 'ID' column .
1592+ QueryBuilderFunctions . selectOperatorInEditModeExpression ( fix , 10 ) ; // Select 'In' operator.
15641593
1565- // Click the initial 'Add Condition' button.
1594+ // Select entity in nested level
1595+ QueryBuilderFunctions . selectEntityAndClickInitialAddCondition ( fix , 0 , 1 ) ;
1596+ // Select return field
1597+ QueryBuilderFunctions . selectFieldsInEditModeExpression ( fix , [ 0 ] , 1 ) ;
1598+ tick ( 100 ) ;
1599+ fix . detectChanges ( ) ;
1600+
1601+ // Click the initial 'Add Condition' button of the query builder.
15661602 QueryBuilderFunctions . clickQueryBuilderInitialAddConditionBtn ( fix , 1 ) ;
15671603 tick ( 100 ) ;
15681604 fix . detectChanges ( ) ;
0 commit comments