Skip to content

Commit 870f744

Browse files
committed
chore(*): update failing tests
1 parent d16f4ff commit 870f744

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,19 +1216,21 @@ describe('igxCombo', () => {
12161216
fixture.detectChanges();
12171217
let items = fixture.debugElement.queryAll(By.css(`.${CSS_CLASS_DROPDOWNLISTITEM}`));
12181218
let lastItem = items[items.length - 1].componentInstance;
1219+
let lastItemIndex = lastItem.index;
12191220
expect(lastItem).toBeDefined();
12201221
lastItem.clicked(mockClick);
12211222
await wait(30);
12221223
fixture.detectChanges();
1223-
expect(dropdown.focusedItem).toEqual(lastItem);
1224+
expect(dropdown.focusedItem.index).toEqual(lastItemIndex);
12241225
dropdown.navigateItem(-1);
12251226
await wait(30);
12261227
fixture.detectChanges();
12271228
expect(virtualMockDOWN).toHaveBeenCalledTimes(0);
1229+
lastItemIndex = lastItem.index;
12281230
lastItem.clicked(mockClick);
12291231
await wait(30);
12301232
fixture.detectChanges();
1231-
expect(dropdown.focusedItem).toEqual(lastItem);
1233+
expect(dropdown.focusedItem.index).toEqual(lastItemIndex);
12321234
dropdown.navigateNext();
12331235
await wait(30);
12341236
fixture.detectChanges();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ export class IgxFilteringService implements OnDestroy {
105105
this._overlayService.onClosed.pipe(
106106
filter(overlay => overlay.id === this._componentOverlayId),
107107
takeUntil(this.destroy$)).subscribe(() => {
108-
console.log('Close');
109108
this._componentOverlayId = null;
110109
this.grid.theadRow.nativeElement.focus();
111110
});

projects/igniteui-angular/src/lib/grids/grid/grid-cell-editing.spec.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ColumnEditablePropertyTestComponent
1414
} from '../../test-utils/grid-samples.spec';
1515
import { DebugElement } from '@angular/core';
16+
import { setupGridScrollDetection } from '../../test-utils/helper-utils.spec';
1617

1718
const DEBOUNCETIME = 30;
1819
const CELL_CSS_CLASS = '.igx-grid__td';
@@ -381,38 +382,36 @@ describe('IgxGrid - Cell Editing #grid', () => {
381382
});
382383

383384
it('When cell in editMode and try to navigate with `ArrowUp` - focus should remain over the input.', (async () => {
384-
const verticalScroll = grid.verticalScrollContainer.getScroll();
385-
let expectedScroll;
386-
let cellElem;
387-
GridFunctions.scrollTop(grid, 1000);
388-
await wait(500);
385+
setupGridScrollDetection(fixture, grid);
386+
grid.navigateTo(8);
387+
await wait(DEBOUNCETIME);
388+
fixture.detectChanges();
389+
await wait(DEBOUNCETIME);
389390
fixture.detectChanges();
390391

391-
let testCells = grid.getColumnByName('firstName').cells;
392+
const testCells = grid.getColumnByName('firstName').cells;
392393
let cell = testCells[testCells.length - 1];
393-
cellElem = cell.nativeElement;
394+
const cellRowIndex = cell.rowIndex;
395+
let cellElem = cell.nativeElement;
394396

395-
cellElem.dispatchEvent(new Event('focus'));
396-
cellElem.dispatchEvent(new MouseEvent('dblclick'));
397+
UIInteractions.simulateDoubleClickAndSelectEvent(cellElem);
398+
await wait(DEBOUNCETIME);
397399
fixture.detectChanges();
398-
await wait(50);
399400

400-
let inputElem: HTMLInputElement = document.activeElement as HTMLInputElement;
401+
const inputElem: HTMLInputElement = document.activeElement as HTMLInputElement;
401402
expect(cell.editMode).toBeTruthy();
402403
expect(cellElem.classList.contains(CELL_CLASS_IN_EDIT_MODE)).toBe(true);
403-
expectedScroll = verticalScroll.scrollTop;
404+
const expectedScroll = grid.verticalScrollContainer.getScroll().scrollTop;
404405

405406
UIInteractions.triggerKeyDownEvtUponElem('ArrowUp', inputElem, true);
406-
fixture.detectChanges();
407407
await wait(DEBOUNCETIME);
408+
fixture.detectChanges();
408409

409-
inputElem = document.activeElement as HTMLInputElement;
410-
testCells = grid.getColumnByName('firstName').cells;
411-
cell = testCells[testCells.length - 1];
410+
cell = grid.getCellByColumn(cellRowIndex, 'firstName' );
412411
cellElem = cell.nativeElement;
413412
expect(cell.editMode).toBeTruthy();
414413
expect(cellElem.classList.contains(CELL_CLASS_IN_EDIT_MODE)).toBe(true);
415-
expect(verticalScroll.scrollTop).toBe(expectedScroll);
414+
expect(grid.verticalScrollContainer.getScroll().scrollTop).toBe(expectedScroll);
416415
}));
417416

418417
it('When cell in editMode and try to navigate with `ArrowRight` - focus should remain over the input.', (async () => {

0 commit comments

Comments
 (0)