Search in sources :

Example 56 with Event

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));
}
Also used : HTMLDivElement(elemental2.dom.HTMLDivElement) Test(org.junit.Test)

Example 57 with 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();
}
Also used : Element(elemental2.dom.Element) HTMLInputElement(elemental2.dom.HTMLInputElement) HTMLDivElement(elemental2.dom.HTMLDivElement) Event(elemental2.dom.Event) KeyboardEvent(elemental2.dom.KeyboardEvent) JQuery(org.uberfire.client.views.pfly.selectpicker.JQuery) Test(org.junit.Test)

Example 58 with Event

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();
}
Also used : Element(elemental2.dom.Element) HTMLInputElement(elemental2.dom.HTMLInputElement) HTMLDivElement(elemental2.dom.HTMLDivElement) Event(elemental2.dom.Event) KeyboardEvent(elemental2.dom.KeyboardEvent) JQuery(org.uberfire.client.views.pfly.selectpicker.JQuery) Test(org.junit.Test)

Example 59 with Event

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();
}
Also used : Element(elemental2.dom.Element) HTMLInputElement(elemental2.dom.HTMLInputElement) HTMLDivElement(elemental2.dom.HTMLDivElement) Event(elemental2.dom.Event) KeyboardEvent(elemental2.dom.KeyboardEvent) JQuery(org.uberfire.client.views.pfly.selectpicker.JQuery) Test(org.junit.Test)

Example 60 with Event

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));
}
Also used : HTMLElement(elemental2.dom.HTMLElement) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Event(elemental2.dom.Event) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)50 HTMLElement (elemental2.dom.HTMLElement)27 Event (elemental2.dom.Event)26 KeyboardEvent (elemental2.dom.KeyboardEvent)19 Element (elemental2.dom.Element)18 MouseEvent (elemental2.dom.MouseEvent)16 HTMLDivElement (elemental2.dom.HTMLDivElement)15 HTMLInputElement (elemental2.dom.HTMLInputElement)13 HTMLButtonElement (elemental2.dom.HTMLButtonElement)12 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)10 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)7 CSSStyleDeclaration (elemental2.dom.CSSStyleDeclaration)7 JQuery (org.uberfire.client.views.pfly.selectpicker.JQuery)7 DOMRect (elemental2.dom.DOMRect)5 DOMTokenList (elemental2.dom.DOMTokenList)5 DomGlobal (elemental2.dom.DomGlobal)5 LazyReverseView (com.github.mvp4g.mvp4g2.core.ui.LazyReverseView)4 AbstractCell (com.google.gwt.cell.client.AbstractCell)4 Elements.button (org.jboss.gwt.elemento.core.Elements.button)4 Elements.div (org.jboss.gwt.elemento.core.Elements.div)4