Skip to content

Commit f2619e9

Browse files
committed
chore(*): update failing tests
1 parent e1680a5 commit f2619e9

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ describe('Dialog', () => {
318318
expect(dialog.isOpen).toEqual(true);
319319

320320
// Press 'escape' key
321-
UIInteractions.triggerKeyDownEvtUponElem('Escape', document.documentElement);
321+
UIInteractions.triggerKeyDownEvtUponElem('Escape', document.activeElement);
322322
tick(100);
323323
fix.detectChanges();
324324

projects/igniteui-angular/src/lib/directives/autocomplete/autocomplete.directive.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ describe('IgxAutocomplete', () => {
616616
UIInteractions.triggerKeyDownEvtUponElem('enter', input.nativeElement, true);
617617
tick();
618618
fixture.detectChanges();
619-
expect(autocomplete.handleKeyDown).toHaveBeenCalledTimes(1);
619+
expect(autocomplete.handleKeyDown).toHaveBeenCalledTimes(3);
620620
expect(autocomplete.onInput).toHaveBeenCalledTimes(2);
621621
expect(autocomplete.close).toHaveBeenCalledTimes(1);
622622
expect(autocomplete.target.close).toHaveBeenCalledTimes(2);
@@ -625,7 +625,7 @@ describe('IgxAutocomplete', () => {
625625
spyOn(IgxDropDownItemNavigationDirective.prototype, 'handleKeyDown').and.callThrough();
626626
UIInteractions.triggerKeyDownEvtUponElem('ArrowDown', input.nativeElement, true);
627627
fixture.detectChanges();
628-
expect(autocomplete.handleKeyDown).toHaveBeenCalledTimes(2);
628+
expect(autocomplete.handleKeyDown).toHaveBeenCalledTimes(4);
629629
expect(IgxDropDownItemNavigationDirective.prototype.handleKeyDown).toHaveBeenCalledTimes(0);
630630

631631
startsWith = 'w';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2657,7 +2657,7 @@ describe('IgxGrid - Cell selection #grid', () => {
26572657
expect(grid.getSelectedData()).toEqual(selectedData);
26582658
const cell = grid.getCellByColumn(2, 'ID');
26592659

2660-
UIInteractions.triggerKeyDownEvtUponElem('space', cell.nativeElement, true, false, false);
2660+
GridFunctions.simulateGridContentKeydown(fix, 'space');
26612661
fix.detectChanges();
26622662

26632663
expect(grid.getRowByIndex(2).selected).toBeTruthy();

projects/igniteui-angular/src/lib/grids/grid/grid-row-selection.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ describe('IgxGrid - Row Selection #grid', () => {
351351
GridSelectionFunctions.verifyRowSelected(firstRow, false);
352352

353353
// Press Space key on the cell
354-
UIInteractions.triggerKeyDownEvtUponElem('space', cell.nativeElement, true);
354+
GridFunctions.simulateGridContentKeydown(fix, 'space');
355355
fix.detectChanges();
356356
await wait(DEBOUNCETIME);
357357

@@ -369,7 +369,7 @@ describe('IgxGrid - Row Selection #grid', () => {
369369
GridSelectionFunctions.verifyRowSelected(firstRow);
370370

371371
// Click Space on the cell
372-
UIInteractions.triggerKeyDownEvtUponElem('space', cell.nativeElement, true);
372+
GridFunctions.simulateGridContentKeydown(fix, 'space');
373373
fix.detectChanges();
374374
await wait(DEBOUNCETIME);
375375

@@ -378,7 +378,7 @@ describe('IgxGrid - Row Selection #grid', () => {
378378
GridSelectionFunctions.verifyRowSelected(secondRow);
379379

380380
// Click again Space on the cell
381-
UIInteractions.triggerKeyDownEvtUponElem('space', cell.nativeElement, true);
381+
GridFunctions.simulateGridContentKeydown(fix, 'space');
382382
fix.detectChanges();
383383
await wait(DEBOUNCETIME);
384384

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class ControlsFunction {
5959
}
6060

6161
public static getCheckboxInput(name: string, element: DebugElement, fix) {
62-
const checkboxEl = this.getCheckboxElement(name, element, fix);
62+
const checkboxEl = ControlsFunction.getCheckboxElement(name, element, fix);
6363
const chkInput = checkboxEl.query(By.css('input')).nativeElement as HTMLInputElement;
6464

6565
return chkInput;
@@ -76,7 +76,7 @@ export class ControlsFunction {
7676
}
7777

7878
public static verifyCheckbox(name: string, isChecked: boolean, isDisabled: boolean, element: DebugElement, fix) {
79-
const chkInput = this.getCheckboxInput(name, element, fix);
79+
const chkInput = ControlsFunction.getCheckboxInput(name, element, fix);
8080
expect(chkInput.type).toBe('checkbox');
8181
expect(chkInput.disabled).toBe(isDisabled);
8282
expect(chkInput.checked).toBe(isChecked);

projects/igniteui-angular/src/lib/time-picker/time-picker.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,8 @@ describe('IgxTimePicker', () => {
12921292

12931293
const customValue = '08:05 AM';
12941294

1295-
UIInteractions.sendInputElementValue(input, customValue);
1295+
input.nativeElement.value = customValue;
1296+
input.nativeElement.dispatchEvent(new Event('input'));
12961297
fixture.detectChanges();
12971298

12981299
input.nativeElement.dispatchEvent(new Event('blur'));
@@ -1315,7 +1316,9 @@ describe('IgxTimePicker', () => {
13151316
expect(input.nativeElement.value).toBe('11:05 AM', 'SpinLoop Down wrong time');
13161317

13171318
// set a new value which is the max value
1318-
UIInteractions.sendInputElementValue(input, '11:03 AM');
1319+
input.nativeElement.focus();
1320+
input.nativeElement.value = '11:03 AM';
1321+
input.nativeElement.dispatchEvent(new Event('input'));
13191322
fixture.detectChanges();
13201323

13211324
input.nativeElement.dispatchEvent(new Event('blur'));

0 commit comments

Comments
 (0)