Skip to content

Commit dc8da0f

Browse files
committed
chore(*): address review comments
1 parent 7412ef5 commit dc8da0f

File tree

1 file changed

+38
-42
lines changed

1 file changed

+38
-42
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-ui.spec.ts

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
import { GridSelectionMode, FilterMode } from '../common/enums';
4545
import { ControlsFunction } from '../../test-utils/controls-functions.spec';
4646

47+
const DEBOUNCETIME = 30;
4748
const FILTER_UI_ROW = 'igx-grid-filtering-row';
4849
const FILTER_UI_CELL = 'igx-grid-filtering-cell';
4950

@@ -276,27 +277,27 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
276277
const prefix = GridFunctions.getFilterRowPrefix(fix);
277278

278279
input.triggerEventHandler('click', null);
279-
tick(30);
280+
tick(DEBOUNCETIME);
280281
fix.detectChanges();
281282
GridFunctions.verifyFilteringDropDownIsOpened(fix);
282283

283284
UIInteractions.triggerEventHandlerKeyDown(' ', prefix);
284-
tick(30);
285+
tick(DEBOUNCETIME);
285286
fix.detectChanges();
286287
GridFunctions.verifyFilteringDropDownIsOpened(fix, false);
287288

288289
UIInteractions.triggerEventHandlerKeyDown('Enter', input);
289-
tick(30);
290+
tick(DEBOUNCETIME);
290291
fix.detectChanges();
291292
GridFunctions.verifyFilteringDropDownIsOpened(fix);
292293

293294
UIInteractions.triggerEventHandlerKeyDown('Tab', prefix);
294-
tick(30);
295+
tick(DEBOUNCETIME);
295296
fix.detectChanges();
296297
GridFunctions.verifyFilteringDropDownIsOpened(fix, false);
297298

298299
UIInteractions.triggerEventHandlerKeyDown(' ', input);
299-
tick(30);
300+
tick(DEBOUNCETIME);
300301
fix.detectChanges();
301302
GridFunctions.verifyFilteringDropDownIsOpened(fix);
302303
}));
@@ -1296,7 +1297,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
12961297
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
12971298
const input = filterUIRow.query(By.directive(IgxInputDirective));
12981299
UIInteractions.triggerEventHandlerKeyDown('ArrowDown', input, true);
1299-
tick(30);
1300+
tick(DEBOUNCETIME);
13001301
fix.detectChanges();
13011302
GridFunctions.verifyFilteringDropDownIsOpened(fix);
13021303
}));
@@ -1345,7 +1346,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
13451346

13461347
// submit the input with empty value
13471348
UIInteractions.triggerEventHandlerKeyDown('Enter', input);
1348-
tick(50);
1349+
tick(DEBOUNCETIME);
13491350
fix.detectChanges();
13501351

13511352
filterChip = filterUIRow.query(By.directive(IgxChipComponent));
@@ -1681,7 +1682,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
16811682

16821683
it('Should remove first condition chip when click \'clear\' button and focus \'more\' icon.', fakeAsync(() => {
16831684
grid.getColumnByName('ProductName').width = '160px';
1684-
tick(50);
1685+
tick(DEBOUNCETIME);
16851686
fix.detectChanges();
16861687

16871688
// Add initial filtering conditions
@@ -1714,7 +1715,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
17141715

17151716
it('Should focus \'more\' icon when close filter row.', fakeAsync(() => {
17161717
grid.getColumnByName('ProductName').width = '80px';
1717-
tick(50);
1718+
tick(DEBOUNCETIME);
17181719
fix.detectChanges();
17191720

17201721
// Add initial filtering conditions
@@ -1743,15 +1744,15 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
17431744

17441745
// close filter row
17451746
GridFunctions.closeFilterRow(fix);
1746-
tick(50);
1747+
tick(DEBOUNCETIME);
17471748

17481749
moreIcon = GridFunctions.getFilterIndicatorForColumn('ProductName', fix)[0];
17491750
expect(document.activeElement).toBe(moreIcon.nativeElement);
17501751
}));
17511752

17521753
it('Should update active element when click \'clear\' button of last chip and there is no \`more\` icon.', fakeAsync(() => {
17531754
grid.getColumnByName('ProductName').width = '350px';
1754-
tick(50);
1755+
tick(DEBOUNCETIME);
17551756
fix.detectChanges();
17561757

17571758
// Add initial filtering conditions
@@ -1775,7 +1776,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
17751776
// Remove last chip.
17761777
// Remove active chip.
17771778
ControlsFunction.clickChipRemoveButton(lastFilterCellChip.nativeElement);
1778-
tick(50);
1779+
tick(DEBOUNCETIME);
17791780
fix.detectChanges();
17801781

17811782
// Verify chips count.
@@ -1876,7 +1877,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
18761877
it('should scroll correct chip in view when one is deleted', async () => {
18771878
grid.width = '800px';
18781879
fix.detectChanges();
1879-
await wait(30);
1880+
await wait(DEBOUNCETIME);
18801881

18811882
// Add initial filtering conditions
18821883
const gridFilteringExpressionsTree = new FilteringExpressionsTree(FilteringLogic.And);
@@ -1892,7 +1893,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
18921893
fix.detectChanges();
18931894

18941895
GridFunctions.clickFilterCellChip(fix, 'ProductName');
1895-
await wait(30);
1896+
await wait(DEBOUNCETIME);
18961897

18971898
verifyMultipleChipsVisibility(fix, [true, true, false, false]);
18981899

@@ -1947,7 +1948,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
19471948

19481949
// Add a condition chip without submitting it.
19491950
GridFunctions.typeValueInFilterRowInput('a', fix);
1950-
tick(30);
1951+
tick(DEBOUNCETIME);
19511952

19521953
// Change filterMode to 'excelStyleFilter`
19531954
grid.filterMode = FilterMode.excelStyleFilter;
@@ -2467,15 +2468,15 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
24672468
const sortAsc = GridFunctions.getExcelStyleFilteringSortButtons(fix)[0];
24682469

24692470
UIInteractions.simulateClickEvent(sortAsc);
2470-
tick(30);
2471+
tick(DEBOUNCETIME);
24712472
fix.detectChanges();
24722473

24732474
expect(grid.sortingExpressions[0].fieldName).toEqual('Downloads');
24742475
expect(grid.sortingExpressions[0].dir).toEqual(SortingDirection.Asc);
24752476
ControlsFunction.verifyButtonIsSelected(sortAsc);
24762477

24772478
UIInteractions.simulateClickEvent(sortAsc);
2478-
tick(30);
2479+
tick(DEBOUNCETIME);
24792480
fix.detectChanges();
24802481

24812482
expect(grid.sortingExpressions.length).toEqual(0);
@@ -2491,15 +2492,15 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
24912492
const sortDesc = GridFunctions.getExcelStyleFilteringSortButtons(fix)[1];
24922493

24932494
UIInteractions.simulateClickEvent(sortDesc);
2494-
tick(30);
2495+
tick(DEBOUNCETIME);
24952496
fix.detectChanges();
24962497

24972498
expect(grid.sortingExpressions[0].fieldName).toEqual('Downloads');
24982499
expect(grid.sortingExpressions[0].dir).toEqual(SortingDirection.Desc);
24992500
ControlsFunction.verifyButtonIsSelected(sortDesc);
25002501

25012502
UIInteractions.simulateClickEvent(sortDesc);
2502-
tick(30);
2503+
tick(DEBOUNCETIME);
25032504
fix.detectChanges();
25042505

25052506
expect(grid.sortingExpressions.length).toEqual(0);
@@ -2516,15 +2517,15 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
25162517
const sortDesc = GridFunctions.getExcelStyleFilteringSortButtons(fix)[1];
25172518

25182519
UIInteractions.simulateClickEvent(sortDesc);
2519-
tick(30);
2520+
tick(DEBOUNCETIME);
25202521
fix.detectChanges();
25212522

25222523
expect(grid.sortingExpressions[0].fieldName).toEqual('Downloads');
25232524
expect(grid.sortingExpressions[0].dir).toEqual(SortingDirection.Desc);
25242525
ControlsFunction.verifyButtonIsSelected(sortDesc);
25252526

25262527
UIInteractions.simulateClickEvent(sortAsc);
2527-
tick(30);
2528+
tick(DEBOUNCETIME);
25282529
fix.detectChanges();
25292530

25302531
expect(grid.sortingExpressions[0].fieldName).toEqual('Downloads');
@@ -3125,7 +3126,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
31253126
fix.detectChanges();
31263127

31273128
// Open excel style filtering component and verify its display density
3128-
GridFunctions.clickExcelFilterIcon(fix, 'ProductName');
3129+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
31293130
tick(100);
31303131
fix.detectChanges();
31313132
verifyExcelStyleFilteringDisplayDensity(fix, DisplayDensity.compact);
@@ -3137,7 +3138,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
31373138
fix.detectChanges();
31383139

31393140
// Open excel style filtering component and verify its display density
3140-
GridFunctions.clickExcelFilterIcon(fix, 'ProductName');
3141+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
31413142
tick(100);
31423143
fix.detectChanges();
31433144
verifyExcelStyleFilteringDisplayDensity(fix, DisplayDensity.cosy);
@@ -3279,11 +3280,6 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
32793280
it('display density is properly applied on the excel custom dialog\'s date expression dropdown',
32803281
fakeAsync(() => {
32813282
const gridNativeElement = fix.debugElement.query(By.css('igx-grid')).nativeElement;
3282-
3283-
// Open excel style custom filtering dialog.
3284-
// GridFunctions.clickExcelFilterIcon(fix, 'ReleaseDate');
3285-
// tick();
3286-
// fix.detectChanges();
32873283
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ReleaseDate');
32883284

32893285
GridFunctions.clickExcelFilterCascadeButton(fix);
@@ -3616,7 +3612,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
36163612

36173613
// Verify scrollbar is visible for 'comfortable'.
36183614
GridFunctions.clickExcelFilterIcon(fix, 'ProductName');
3619-
await wait(30);
3615+
await wait(DEBOUNCETIME);
36203616
fix.detectChanges();
36213617

36223618
expect(isExcelSearchScrollBarVisible(fix)).toBe(true, 'excel search scrollbar should be visible');
@@ -3629,7 +3625,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
36293625

36303626
// Verify scrollbar is NOT visible for 'cosy'.
36313627
GridFunctions.clickExcelFilterIcon(fix, 'ProductName');
3632-
await wait(30);
3628+
await wait(DEBOUNCETIME);
36333629
fix.detectChanges();
36343630

36353631
expect(isExcelSearchScrollBarVisible(fix)).toBe(false, 'excel search scrollbar should NOT be visible');
@@ -3642,7 +3638,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
36423638

36433639
// Verify scrollbar is NOT visible for 'compact'.
36443640
GridFunctions.clickExcelFilterIcon(fix, 'ProductName');
3645-
await wait(30);
3641+
await wait(DEBOUNCETIME);
36463642
fix.detectChanges();
36473643

36483644
expect(isExcelSearchScrollBarVisible(fix)).toBe(false, 'excel search scrollbar should NOT be visible');
@@ -4285,14 +4281,14 @@ describe('IgxGrid - Custom Filtering Strategy #grid', () => {
42854281
});
42864282

42874283
it('Should be able to override getFieldValue method', fakeAsync(() => {
4288-
GridFunctions.clickFilterCellChipUI(fix, 'Name'); // Name column contains nasted object as a vulue
4284+
GridFunctions.clickFilterCellChipUI(fix, 'Name'); // Name column contains nested object as a value
42894285
tick(150);
42904286
fix.detectChanges();
42914287

42924288
GridFunctions.typeValueInFilterRowInput('ca', fix);
4293-
tick(50);
4289+
tick(DEBOUNCETIME);
42944290
GridFunctions.submitFilterRowInput(fix);
4295-
tick(50);
4291+
tick(DEBOUNCETIME);
42964292
fix.detectChanges();
42974293

42984294
expect(grid.filteredData).toEqual([]);
@@ -4303,14 +4299,14 @@ describe('IgxGrid - Custom Filtering Strategy #grid', () => {
43034299
// Apply the custom strategy and perform the same filter
43044300
grid.filterStrategy = fix.componentInstance.strategy;
43054301
fix.detectChanges();
4306-
GridFunctions.clickFilterCellChipUI(fix, 'Name'); // Name column contains nasted object as a vulue
4302+
GridFunctions.clickFilterCellChipUI(fix, 'Name'); // Name column contains nested object as a value
43074303
tick(150);
43084304
fix.detectChanges();
43094305

43104306
GridFunctions.typeValueInFilterRowInput('ca', fix);
4311-
tick(50);
4307+
tick(DEBOUNCETIME);
43124308
GridFunctions.submitFilterRowInput(fix);
4313-
tick(50);
4309+
tick(DEBOUNCETIME);
43144310
fix.detectChanges();
43154311

43164312
expect(grid.filteredData).toEqual(
@@ -4323,9 +4319,9 @@ describe('IgxGrid - Custom Filtering Strategy #grid', () => {
43234319
fix.detectChanges();
43244320

43254321
GridFunctions.typeValueInFilterRowInput('direct', fix);
4326-
tick(50);
4322+
tick(DEBOUNCETIME);
43274323
GridFunctions.submitFilterRowInput(fix);
4328-
tick(50);
4324+
tick(DEBOUNCETIME);
43294325
fix.detectChanges();
43304326

43314327
expect(grid.filteredData).toEqual([
@@ -4343,9 +4339,9 @@ describe('IgxGrid - Custom Filtering Strategy #grid', () => {
43434339
fix.detectChanges();
43444340

43454341
GridFunctions.typeValueInFilterRowInput('direct', fix);
4346-
tick(50);
4342+
tick(DEBOUNCETIME);
43474343
GridFunctions.submitFilterRowInput(fix);
4348-
tick(50);
4344+
tick(DEBOUNCETIME);
43494345
fix.detectChanges();
43504346

43514347
expect(grid.filteredData).toEqual([]);
@@ -4355,7 +4351,7 @@ describe('IgxGrid - Custom Filtering Strategy #grid', () => {
43554351
grid.filterStrategy = fix.componentInstance.strategy;
43564352
fix.detectChanges();
43574353
grid.filter('Name', 'D', IgxStringFilteringOperand.instance().condition('contains'));
4358-
tick(30);
4354+
tick(DEBOUNCETIME);
43594355
fix.detectChanges();
43604356

43614357
expect(grid.filteredData).toEqual([

0 commit comments

Comments
 (0)