Skip to content

Commit ea218e3

Browse files
committed
chore(*): update failing tests
1 parent faed4ee commit ea218e3

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,9 +1446,9 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
14461446
expect(filteringRow.queryAll(By.css('igx-chip')).length).toEqual(2);
14471447
}));
14481448

1449-
it('Verify filter cell chip is scrolled into view on click.', fakeAsync(() => {
1449+
it('Verify filter cell chip is scrolled into view on click.', async () => {
14501450
grid.width = '470px';
1451-
tick(100);
1451+
await wait(DEBOUNCETIME);
14521452
fix.detectChanges();
14531453

14541454
// Verify 'ReleaseDate' filter chip is not fully visible.
@@ -1458,18 +1458,21 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
14581458
expect(chipRect.right > gridRect.right).toBe(true,
14591459
'chip should not be fully visible and thus not within grid');
14601460

1461-
GridFunctions.clickFilterCellChip(fix, 'ReleaseDate');
1461+
GridFunctions.clickFilterCellChipUI(fix, 'ReleaseDate');
1462+
await wait(DEBOUNCETIME);
1463+
fix.detectChanges();
14621464

1463-
GridFunctions.closeFilterRow(fix);
1464-
tick(100);
1465+
grid.filteringRow.close();
1466+
await wait();
1467+
fix.detectChanges();
14651468

14661469
// Verify 'ReleaseDate' filter chip is fully visible.
14671470
chip = GridFunctions.getFilterChipsForColumn('ReleaseDate', fix)[0].nativeElement;
14681471
chipRect = chip.getBoundingClientRect();
14691472
gridRect = grid.nativeElement.getBoundingClientRect();
14701473
expect(chipRect.left > gridRect.left && chipRect.right < gridRect.right).toBe(true,
14711474
'chip should be fully visible and within grid');
1472-
}));
1475+
});
14731476

14741477
it('Verify condition chips are scrolled into/(out of) view by using arrow buttons.', (async () => {
14751478
grid.width = '700px';

projects/igniteui-angular/src/lib/grids/grid/grid-mrl-keyboard-nav.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,25 +1724,25 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
17241724
fix.detectChanges();
17251725

17261726
GridFunctions.simulateGridContentKeydown(fix, 'end', false, false, true);
1727+
await wait(DEBOUNCETIME * 2);
17271728
zone.simulateOnStable();
1728-
await wait(DEBOUNCETIME);
17291729
fix.detectChanges();
17301730

1731+
await wait(DEBOUNCETIME * 2);
17311732
zone.simulateOnStable();
1732-
await wait(DEBOUNCETIME);
17331733
fix.detectChanges();
17341734

17351735
expect(fix.componentInstance.selectedCell.value)
17361736
.toEqual(fix.componentInstance.data[fix.componentInstance.data.length - 1].Fax);
17371737
expect(fix.componentInstance.selectedCell.column.field).toMatch('Fax');
17381738

17391739
GridFunctions.simulateGridContentKeydown(fix, 'home', false, false, true);
1740+
await wait(DEBOUNCETIME * 2);
17401741
zone.simulateOnStable();
1741-
await wait(DEBOUNCETIME);
17421742
fix.detectChanges();
17431743

1744+
await wait(DEBOUNCETIME * 2);
17441745
zone.simulateOnStable();
1745-
await wait(DEBOUNCETIME);
17461746
fix.detectChanges();
17471747

17481748
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].CompanyName);
@@ -1875,25 +1875,25 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
18751875
fix.detectChanges();
18761876

18771877
GridFunctions.simulateGridContentKeydown(fix, 'end', false, false, true);
1878+
await wait(DEBOUNCETIME * 2);
18781879
zone.simulateOnStable();
1879-
await wait(DEBOUNCETIME);
18801880
fix.detectChanges();
18811881

1882+
await wait(DEBOUNCETIME * 2);
18821883
zone.simulateOnStable();
1883-
await wait(DEBOUNCETIME);
18841884
fix.detectChanges();
18851885

18861886
expect(fix.componentInstance.selectedCell.value)
18871887
.toEqual(fix.componentInstance.data[fix.componentInstance.data.length - 1].Fax);
18881888
expect(fix.componentInstance.selectedCell.column.field).toMatch('Fax');
18891889

18901890
GridFunctions.simulateGridContentKeydown(fix, 'home', false, false, true);
1891+
await wait(DEBOUNCETIME * 2);
18911892
zone.simulateOnStable();
1892-
await wait(DEBOUNCETIME);
18931893
fix.detectChanges();
18941894

1895+
await wait(DEBOUNCETIME * 2);
18951896
zone.simulateOnStable();
1896-
await wait(DEBOUNCETIME);
18971897
fix.detectChanges();
18981898

18991899
expect(fix.componentInstance.selectedCell.value).toEqual(fix.componentInstance.data[0].CompanyName);

projects/igniteui-angular/src/lib/test-utils/grid-functions.spec.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,16 @@ const BANNER_ROW_CLASS = '.igx-banner__row';
4747
const EDIT_OVERLAY_CONTENT = '.igx-overlay__content';
4848
const PAGER_BUTTONS = '.igx-paginator__pager > button';
4949
const ACTIVE_GROUP_ROW_CLASS = 'igx-grid__group-row--active';
50+
const ACTIVE_HEADER_CLASS = 'igx-grid__th--active';
5051
const GROUP_ROW_CLASS = 'igx-grid-groupby-row';
5152
const CELL_SELECTED_CSS_CLASS = 'igx-grid__td--selected';
5253
const ROW_DIV_SELECTION_CHECKBOX_CSS_CLASS = 'igx-grid__cbx-selection';
5354
const ROW_SELECTION_CSS_CLASS = 'igx-grid__tr--selected';
5455
const HEADER_ROW_CSS_CLASS = '.igx-grid__thead';
5556
const CHECKBOX_INPUT_CSS_CLASS = '.igx-checkbox__input';
56-
const SCROLL_START_CSS_CLASS = '.igx-grid__scroll-start';
5757
const CHECKBOX_ELEMENT = 'igx-checkbox';
5858
const ICON_CSS_CLASS = 'material-icons igx-icon';
5959
const CHECKBOX_LBL_CSS_CLASS = '.igx-checkbox__composite';
60-
const DEBOUNCETIME = 50;
6160
const GROUP_EXPANDER_CLASS = '.igx-grid__th-expander';
6261
const GROUP_HEADER_CLASS = '.igx-grid__th-group-title';
6362
const CELL_CSS_CLASS = '.igx-grid__td';
@@ -142,6 +141,14 @@ export class GridFunctions {
142141
return expectedLength;
143142
}
144143

144+
/**
145+
* Focus the grid header
146+
*/
147+
public static focusHeader(fix: ComponentFixture<any>) {
148+
this.getGridHeader(fix).triggerEventHandler('focus', null);
149+
fix.detectChanges();
150+
}
151+
145152
/**
146153
* Focus the first cell in the grid
147154
*/
@@ -297,6 +304,10 @@ export class GridFunctions {
297304
expect(groupRow.nativeElement.classList.contains(ACTIVE_GROUP_ROW_CLASS)).toBe(focused);
298305
}
299306

307+
public static verifyHeaderIsFocused(header, focused = true) {
308+
expect(header.nativeElement.classList.contains(ACTIVE_HEADER_CLASS)).toBe(focused);
309+
}
310+
300311
public static getCurrentCellFromGrid(grid, row, cell) {
301312
const gridRow = grid.rowList.toArray()[row];
302313
const gridCell = gridRow.cells.toArray()[cell];

0 commit comments

Comments
 (0)