Skip to content

Commit 1579a6b

Browse files
test(simple-combo): use triggerEventHandler
1 parent 83ea0f2 commit 1579a6b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ describe('IgxSimpleCombo', () => {
922922
const item1 = fixture.debugElement.query(By.css(`.${CSS_CLASS_DROPDOWNLISTITEM}`));
923923
expect(item1).toBeDefined();
924924

925-
UIInteractions.simulateClickEvent(item1.nativeElement);
925+
item1.triggerEventHandler('click', UIInteractions.getMouseEvent('click'));
926926
fixture.detectChanges();
927927

928928
expect(combo.close).toHaveBeenCalledTimes(1);
@@ -938,7 +938,7 @@ describe('IgxSimpleCombo', () => {
938938
const toggleButton = fixture.debugElement.query(By.directive(IgxIconComponent));
939939
expect(toggleButton).toBeDefined();
940940

941-
UIInteractions.simulateClickEvent(toggleButton.nativeElement);
941+
toggleButton.triggerEventHandler('click', UIInteractions.getMouseEvent('click'));
942942
fixture.detectChanges();
943943

944944
expect(combo.onClick).toHaveBeenCalledTimes(1);
@@ -951,11 +951,12 @@ describe('IgxSimpleCombo', () => {
951951

952952
spyOn(combo, 'close').and.callThrough();
953953

954-
UIInteractions.triggerKeyDownEvtUponElem('ArrowDown', input.nativeElement);
954+
UIInteractions.triggerEventHandlerKeyDown('ArrowDown', input);
955+
tick();
955956
fixture.detectChanges();
956957
expect(document.activeElement).toHaveClass('igx-combo__content');
957958

958-
UIInteractions.triggerKeyDownEvtUponElem('ArrowUp', input.nativeElement, true, true);
959+
UIInteractions.triggerEventHandlerKeyDown('ArrowUp', input, true, true);
959960
fixture.detectChanges();
960961
expect(combo.close).toHaveBeenCalledTimes(1);
961962
}));
@@ -977,37 +978,37 @@ describe('IgxSimpleCombo', () => {
977978
combo.select('Wisconsin');
978979
fixture.detectChanges();
979980

980-
input.nativeElement.focus();
981+
input.triggerEventHandler('focus', {});
981982
fixture.detectChanges();
982983

983-
UIInteractions.triggerKeyDownEvtUponElem('Backspace', input.nativeElement);
984+
UIInteractions.triggerEventHandlerKeyDown('Backspace', input);
984985
fixture.detectChanges();
985986
expect(combo.selection.length).toEqual(0);
986987

987-
input.nativeElement.blur();
988+
input.triggerEventHandler('blur', {});
988989
fixture.detectChanges();
989990

990991
combo.select('Wisconsin');
991992
fixture.detectChanges();
992993

993-
input.nativeElement.focus();
994+
input.triggerEventHandler('focus', {});
994995
fixture.detectChanges();
995996

996-
UIInteractions.triggerKeyDownEvtUponElem('Backspace', input.nativeElement);
997+
UIInteractions.triggerEventHandlerKeyDown('Backspace', input);
997998
fixture.detectChanges();
998999
expect(combo.selection.length).toEqual(0);
9991000
}));
10001001

1001-
it('should close the dropdown (if opened) when tabbing outside of the input', fakeAsync(() => {
1002+
it('should close the dropdown (if opened) when tabbing outside of the input', () => {
10021003
combo.open();
10031004
fixture.detectChanges();
10041005

10051006
spyOn(combo, 'close').and.callThrough();
10061007

1007-
UIInteractions.triggerKeyDownEvtUponElem('Tab', input.nativeElement);
1008+
UIInteractions.triggerEventHandlerKeyDown('Tab', input);
10081009
fixture.detectChanges();
10091010
expect(combo.close).toHaveBeenCalledTimes(1);
1010-
}));
1011+
});
10111012
});
10121013

10131014
describe('Display density', () => {

0 commit comments

Comments
 (0)