Skip to content

Commit 4bf6555

Browse files
committed
test(adv-filtering): discard editing #5496
1 parent 684e7b2 commit 4bf6555

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Diff for: projects/igniteui-angular/src/lib/grids/grid/grid-filtering-advanced.spec.ts

+35
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,41 @@ describe('IgxGrid - Advanced Filtering', () => {
885885
verifyEqualArrays(dropdownValues, expectedValues);
886886
}));
887887

888+
it('Should not commit and close currently edited condition when the \'close\' button is clicked.', fakeAsync(() => {
889+
// Apply advanced filter through API.
890+
const tree = new FilteringExpressionsTree(FilteringLogic.And);
891+
tree.filteringOperands.push({
892+
fieldName: 'Downloads', searchVal: 100, condition: IgxNumberFilteringOperand.instance().condition('greaterThan')
893+
});
894+
grid.advancedFilteringExpressionsTree = tree;
895+
fix.detectChanges();
896+
897+
// Open Advanced Filtering dialog.
898+
GridFunctions.clickAdvancedFilteringButton(fix);
899+
fix.detectChanges();
900+
901+
verifyExpressionChipContent(fix, [0], 'Downloads', 'Greater Than', '100');
902+
903+
// Edit the first expression in the inner 'or' group.
904+
GridFunctions.clickAdvancedFilteringTreeExpressionChip(fix, [0], true); // Double-click the chip
905+
tick(200);
906+
fix.detectChanges();
907+
const input = GridFunctions.getAdvancedFilteringValueInput(fix).querySelector('input');
908+
sendInputNativeElement(fix, input, '500'); // Type filter value.
909+
910+
// Verify the edit mode container is visible.
911+
expect(GridFunctions.getAdvancedFilteringEditModeContainer(fix)).not.toBeNull();
912+
913+
// Close the populated expression.
914+
GridFunctions.clickAdvancedFilteringExpressionCloseButton(fix);
915+
fix.detectChanges();
916+
917+
// Verify the edit mode container is no longer visible.
918+
expect(GridFunctions.getAdvancedFilteringEditModeContainer(fix)).toBeNull();
919+
920+
verifyExpressionChipContent(fix, [0], 'Downloads', 'Greater Than', '100');
921+
}));
922+
888923
it('Should scroll the adding buttons into view when the add icon of a chip is clicked.', (async () => {
889924
// Apply advanced filter through API.
890925
const tree = new FilteringExpressionsTree(FilteringLogic.Or);

0 commit comments

Comments
 (0)