use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class TimePicker method inputOnBlur.
private Object inputOnBlur(final Event event) {
final FocusEvent focusEvent = (FocusEvent) event;
onBlur(focusEvent, view.getElement());
return this;
}
use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class ValueAndDataTypePopoverViewImpl method typeSelectorKeyDownEventListener.
void typeSelectorKeyDownEventListener(final Object event) {
if (event instanceof KeyboardEvent) {
final KeyboardEvent keyEvent = (KeyboardEvent) event;
if (isEnterKeyPressed(keyEvent)) {
hide(true);
keyEvent.preventDefault();
onClosedByKeyboard();
} else if (isEscapeKeyPressed(keyEvent)) {
reset();
hide(false);
onClosedByKeyboard();
} else if (isTabKeyPressed(keyEvent)) {
if (keyEvent.shiftKey) {
final Button manageButton = getManageButton();
manageButton.focus();
} else {
valueEditor.focus();
}
keyEvent.preventDefault();
}
}
}
use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class MenuInitializerTest method testMoveDropDownToBody.
@Test
public void testMoveDropDownToBody() {
final HTMLElement modalInElement = mock(HTMLElement.class);
final HTMLElement target = mock(HTMLElement.class);
final JQuery jQueryModalIn = mock(JQuery.class);
final JQuery jQueryTarget = mock(JQuery.class);
final JQuery jQueryCSS = mock(JQuery.class);
final JQuery jQueryDetach = mock(JQuery.class);
final JQueryEvent event = mock(JQueryEvent.class);
final JSONObject jsonObjectProperties = mock(JSONObject.class);
final JavaScriptObject javaScriptObjectProperties = mock(JavaScriptObject.class);
event.target = target;
doReturn(jsonObjectProperties).when(initializer).bodyDropdownProperties(event);
doReturn(modalInElement).when(initializer).body();
when(jsonObjectProperties.getJavaScriptObject()).thenReturn(javaScriptObjectProperties);
when(jQueryTarget.css(javaScriptObjectProperties)).thenReturn(jQueryCSS);
when(jQueryCSS.detach()).thenReturn(jQueryDetach);
when(initializer.jQuery(modalInElement)).thenReturn(jQueryModalIn);
when(initializer.jQuery(target)).thenReturn(jQueryTarget);
initializer.moveDropDownToBody().call(event);
verify(jQueryModalIn).append(jQueryDetach);
}
use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class BaseSelectorViewTest method testSetOnInputChangeCallbackWithKeyUpEvent.
@Test
public void testSetOnInputChangeCallbackWithKeyUpEvent() {
final Event event = mock(Event.class);
selectorView.setOnInputChangeCallback(eventConsumer);
input.onkeyup.onInvoke(event);
verify(eventConsumer).accept(event);
}
use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class ContextMenuViewTest method testWhenGettingEventPathAndPathIsNull.
@Test
public void testWhenGettingEventPathAndPathIsNull() {
final Event event = mock(Event.class);
final Element element = mock(Element.class);
final JsArray<EventTarget> composedPath = spy(new JsArray<>());
final List<EventTarget> composedPathAsList = new ArrayList<>();
final String value = "test-val";
event.path = null;
composedPathAsList.add(element);
doReturn(composedPathAsList).when(composedPath).asList();
when(event.composedPath()).thenReturn(composedPath);
when(element.getAttribute(Mockito.<String>any())).thenReturn(value);
final List<Element> eventPath = contextMenuView.getEventPath(event);
assertThat(eventPath).isNotNull();
assertThat(eventPath).isNotEmpty();
assertThat(eventPath.size()).isEqualTo(1);
assertThat(eventPath.get(0)).extracting(elem -> elem.getAttribute("test-attr")).isEqualTo(value);
}
Aggregations