use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class DataTypeShortcutsTest method testIsSearchBarTargetWhenItReturnsFalse.
@Test
public void testIsSearchBarTargetWhenItReturnsFalse() {
final HTMLDivElement element = mock(HTMLDivElement.class);
event.target = element;
when(element.getAttribute("data-field")).thenReturn("something");
assertFalse(shortcuts.isSearchBarTarget(event));
}
use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class DataTypeShortcutsTest method testClickListenerWhenDropdownMenuContainsTarget.
@Test
public void testClickListenerWhenDropdownMenuContainsTarget() {
final Event target = mock(Event.class);
final Element targetElement = mock(Element.class);
final Element targetMenu = mock(Element.class);
final JQuery jQuery = mock(JQuery.class);
JQuery.$ = jQuery;
target.target = targetElement;
doReturn(targetMenu).when(targetElement).closest(SELECT_DATATYPE_MENU);
doReturn(false).when(shortcuts).tabContentContainsTarget(target);
shortcuts.clickListener(target);
verify(listShortcuts).focusIn();
verify(listShortcuts, never()).reset();
}
use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class DataTypeShortcutsTest method testClickListenerWhenConstraintModalFooterContainsTarget.
@Test
public void testClickListenerWhenConstraintModalFooterContainsTarget() {
final Event target = mock(Event.class);
final Element targetElement = mock(Element.class);
final Element targetMenu = mock(Element.class);
final JQuery jQuery = mock(JQuery.class);
JQuery.$ = jQuery;
target.target = targetElement;
doReturn(targetMenu).when(targetElement).closest(MODAL_FOOTER);
doReturn(false).when(shortcuts).tabContentContainsTarget(target);
doReturn(false).when(shortcuts).dropdownMenuContainsTarget(target);
shortcuts.clickListener(target);
verify(listShortcuts).focusIn();
verify(listShortcuts, never()).reset();
}
use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class DataTypeShortcutsTest method testClickListenerWhenTabContentContainsTarget.
@Test
public void testClickListenerWhenTabContentContainsTarget() {
final Event target = mock(Event.class);
final Element targetElement = mock(Element.class);
final Element tabContentElement = mock(Element.class);
final JQuery jQuery = mock(JQuery.class);
JQuery.$ = jQuery;
target.target = targetElement;
doReturn(tabContentElement).when(shortcuts).querySelector(".tab-content");
when(jQuery.contains(tabContentElement, targetElement)).thenReturn(true);
shortcuts.clickListener(target);
verify(listShortcuts).focusIn();
verify(listShortcuts, never()).reset();
}
use of elemental2.dom.Event in project kie-wb-common by kiegroup.
the class StructureTypesTooltipViewTest method testIsOutsideWhenItsOutside.
@Test
public void testIsOutsideWhenItsOutside() {
final Event event = mock(Event.class);
final HTMLElement target = mock(HTMLElement.class);
event.target = target;
when(element.contains(target)).thenReturn(false);
doReturn(true).when(view).isTooltipVisible();
assertTrue(view.isOutside(event));
}
Aggregations