use of org.uberfire.client.views.pfly.selectpicker.JQuery in project kie-wb-common by kiegroup.
the class MenuInitializerTest method testInit.
@Test
public void testInit() {
final JQuery jQuery = mock(JQuery.class);
final JQuery.CallbackFunction moveDropDownToBody = mock(JQuery.CallbackFunction.class);
final JQuery.CallbackFunction moveDropDownToKebabContainer = mock(JQuery.CallbackFunction.class);
final Element dropdown = mock(Element.class);
doReturn(dropdown).when(initializer).dropdown();
doReturn(moveDropDownToBody).when(initializer).moveDropDownToBody();
doReturn(moveDropDownToKebabContainer).when(initializer).moveDropDownToKebabContainer();
doReturn(jQuery).when(initializer).jQuery(dropdown);
initializer.init();
verify(jQuery).on("show.bs.dropdown", moveDropDownToBody);
verify(jQuery).on("hidden.bs.dropdown", moveDropDownToKebabContainer);
}
use of org.uberfire.client.views.pfly.selectpicker.JQuery in project kie-wb-common by kiegroup.
the class MenuInitializerTest method testMoveDropDownToKebabContainer.
@Test
public void testMoveDropDownToKebabContainer() {
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).emptyProperties();
doReturn(modalInElement).when(initializer).body();
when(jsonObjectProperties.getJavaScriptObject()).thenReturn(javaScriptObjectProperties);
when(jQueryTarget.css(javaScriptObjectProperties)).thenReturn(jQueryCSS);
when(jQueryCSS.detach()).thenReturn(jQueryDetach);
when(initializer.jQuery(kebabMenu)).thenReturn(jQueryModalIn);
when(initializer.jQuery(target)).thenReturn(jQueryTarget);
initializer.moveDropDownToKebabContainer().call(event);
verify(jQueryModalIn).append(jQueryDetach);
}
use of org.uberfire.client.views.pfly.selectpicker.JQuery in project kie-wb-common by kiegroup.
the class DataTypeConstraintModalViewTest method testSetupOnHideHandler.
@Test
public void testSetupOnHideHandler() {
final HTMLElement body = mock(HTMLElement.class);
final Node modalBody = mock(Node.class);
final Node modalContent = mock(Node.class);
final Node modalDialog = mock(Node.class);
final Node modalComponent = mock(Node.class);
final Command command = mock(Command.class);
final JQuery jQuery = mock(JQuery.class);
final ArgumentCaptor<CallbackFunction> captor = ArgumentCaptor.forClass(CallbackFunction.class);
body.parentNode = modalBody;
modalBody.parentNode = modalContent;
modalContent.parentNode = modalDialog;
modalDialog.parentNode = modalComponent;
doReturn(body).when(view).getBody();
when(view.constraintModalJQuery()).thenReturn(jQuery);
view.setupOnHideHandler(command);
verify(jQuery).on(eq("hidden.bs.modal"), captor.capture());
captor.getValue().call(mock(JQueryEvent.class));
verify(command).execute();
}
use of org.uberfire.client.views.pfly.selectpicker.JQuery in project kie-wb-common by kiegroup.
the class DataTypeShortcutsTest method testClickListenerWhenTabContentDoesNotContainTarget.
@Test
public void testClickListenerWhenTabContentDoesNotContainTarget() {
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(false);
shortcuts.clickListener(target);
verify(listShortcuts).reset();
verify(listShortcuts, never()).focusIn();
}
use of org.uberfire.client.views.pfly.selectpicker.JQuery in project kie-wb-common by kiegroup.
the class ScrollHelperTest method testAnimatedScrollToBottomWithTwoArguments.
@Test
public void testAnimatedScrollToBottomWithTwoArguments() {
final Element element = mock(Element.class);
final JQuery jQuery = mock(JQuery.class);
final JavaScriptObject javaScriptObject = mock(JavaScriptObject.class);
final double scrollHeight = 123;
when(scrollHelper.elementJQuery(element)).thenReturn(jQuery);
doReturn(javaScriptObject).when(scrollHelper).property("scrollTop", scrollHeight);
scrollHelper.animatedScrollToBottom(element, scrollHeight);
verify(jQuery).animate(javaScriptObject, 800);
}
Aggregations