Search in sources :

Example 1 with CallbackFunction

use of org.uberfire.client.views.pfly.selectpicker.JQuery.CallbackFunction 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();
}
Also used : CallbackFunction(org.uberfire.client.views.pfly.selectpicker.JQuery.CallbackFunction) HTMLElement(elemental2.dom.HTMLElement) Command(org.uberfire.mvp.Command) JQueryEvent(org.uberfire.client.views.pfly.selectpicker.JQueryEvent) Node(elemental2.dom.Node) JQuery(org.uberfire.client.views.pfly.selectpicker.JQuery) Test(org.junit.Test)

Aggregations

HTMLElement (elemental2.dom.HTMLElement)1 Node (elemental2.dom.Node)1 Test (org.junit.Test)1 JQuery (org.uberfire.client.views.pfly.selectpicker.JQuery)1 CallbackFunction (org.uberfire.client.views.pfly.selectpicker.JQuery.CallbackFunction)1 JQueryEvent (org.uberfire.client.views.pfly.selectpicker.JQueryEvent)1 Command (org.uberfire.mvp.Command)1