use of org.uberfire.client.views.pfly.selectpicker.JQuery 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 org.uberfire.client.views.pfly.selectpicker.JQuery in project kie-wb-common by kiegroup.
the class DataTypeShortcutsTest method testClickListenerWhenDatatypeElementIsClicked.
@Test
public void testClickListenerWhenDatatypeElementIsClicked() {
final Event target = mock(Event.class);
final Element targetElement = mock(Element.class);
final Element targetMenu = mock(Element.class);
final Element dataTypeRowElement = 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);
doReturn(dataTypeRowElement).when(targetElement).closest(".list-group-item");
shortcuts.clickListener(target);
verify(listShortcuts).focusIn();
verify(listShortcuts).highlight(dataTypeRowElement);
verify(listShortcuts, never()).reset();
}
use of org.uberfire.client.views.pfly.selectpicker.JQuery 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 org.uberfire.client.views.pfly.selectpicker.JQuery 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 org.uberfire.client.views.pfly.selectpicker.JQuery 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();
}
Aggregations