use of elemental2.dom.KeyboardEvent in project kie-wb-common by kiegroup.
the class ValueAndDataTypePopoverViewImplTest method testKeyDownEventListenerEsc.
@Test
public void testKeyDownEventListenerEsc() {
final KeyboardEvent keyboardEvent = mock(KeyboardEvent.class);
doReturn(false).when(view).isEnterKeyPressed(keyboardEvent);
doReturn(true).when(view).isEscapeKeyPressed(keyboardEvent);
doNothing().when(view).hide(false);
view.manageButtonKeyDownEventListener(keyboardEvent);
verify(view).hide(false);
verify(view).reset();
verify(view).onClosedByKeyboard();
}
use of elemental2.dom.KeyboardEvent in project kie-wb-common by kiegroup.
the class ValueAndDataTypePopoverViewImplTest method testManagerButtonKeyDownEventListenerEsc.
@Test
public void testManagerButtonKeyDownEventListenerEsc() {
final KeyboardEvent keyboardEvent = mock(KeyboardEvent.class);
doReturn(false).when(view).isEnterKeyPressed(keyboardEvent);
doReturn(true).when(view).isEscapeKeyPressed(keyboardEvent);
final ValueAndDataTypePopoverViewImpl.BootstrapSelectDropDownMonitor monitor = mock(ValueAndDataTypePopoverViewImpl.BootstrapSelectDropDownMonitor.class);
doReturn(monitor).when(view).getMonitor();
final elemental2.dom.Element menuElement = mock(elemental2.dom.Element.class);
doReturn(menuElement).when(monitor).getMenuElement();
view.manageButtonKeyDownEventListener(keyboardEvent);
verify(view).hide(false);
verify(view).reset();
verify(view).onClosedByKeyboard();
}
use of elemental2.dom.KeyboardEvent in project kie-wb-common by kiegroup.
the class ValueAndDataTypePopoverViewImplTest method testTypeSelectorKeyDownEventListenerTabKey.
@Test
public void testTypeSelectorKeyDownEventListenerTabKey() {
final KeyboardEvent keyboardEvent = mock(KeyboardEvent.class);
doReturn(false).when(view).isEnterKeyPressed(keyboardEvent);
doReturn(false).when(view).isEscapeKeyPressed(keyboardEvent);
doReturn(true).when(view).isTabKeyPressed(keyboardEvent);
view.typeSelectorKeyDownEventListener(keyboardEvent);
verify(valueEditor).focus();
verify(keyboardEvent).preventDefault();
}
use of elemental2.dom.KeyboardEvent in project kie-wb-common by kiegroup.
the class ValueAndDataTypePopoverViewImplTest method testTypeSelectorKeyDownEventListenerWhenIsNotAHandledKey.
@Test
public void testTypeSelectorKeyDownEventListenerWhenIsNotAHandledKey() {
final KeyboardEvent keyboardEvent = mock(KeyboardEvent.class);
doReturn(false).when(view).isEnterKeyPressed(keyboardEvent);
doReturn(false).when(view).isEscapeKeyPressed(keyboardEvent);
doReturn(false).when(view).isTabKeyPressed(keyboardEvent);
view.typeSelectorKeyDownEventListener(keyboardEvent);
verify(view, never()).hide(anyBoolean());
verify(keyboardEvent, never()).preventDefault();
verify(view, never()).onClosedByKeyboard();
verify(view, never()).reset();
verify(manageButton, never()).focus();
verify(valueEditor, never()).focus();
}
use of elemental2.dom.KeyboardEvent in project kie-wb-common by kiegroup.
the class ValueAndDataTypePopoverViewImplTest method testTypeSelectorKeyDownEventListenerShiftTabKey.
@Test
public void testTypeSelectorKeyDownEventListenerShiftTabKey() {
final KeyboardEvent keyboardEvent = mock(KeyboardEvent.class);
keyboardEvent.shiftKey = true;
doReturn(false).when(view).isEnterKeyPressed(keyboardEvent);
doReturn(false).when(view).isEscapeKeyPressed(keyboardEvent);
doReturn(true).when(view).isTabKeyPressed(keyboardEvent);
view.typeSelectorKeyDownEventListener(keyboardEvent);
verify(manageButton).focus();
verify(keyboardEvent).preventDefault();
}
Aggregations