@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); }
JQuery.CallbackFunction moveDropDownToBody() { return (event) -> { final JavaScriptObject properties = bodyDropdownProperties(event).getJavaScriptObject(); JQuery $ = jQuery(body()); JQuery css = jQuery(event.target).css(properties); JQuery detach = css.detach(); $.append(detach); }; }
MenuInitializer { JQuery.CallbackFunction moveDropDownToBody() { return (event) -> { final JavaScriptObject properties = bodyDropdownProperties(event).getJavaScriptObject(); JQuery $ = jQuery(body()); JQuery css = jQuery(event.target).css(properties); JQuery detach = css.detach(); $.append(detach); }; } }
MenuInitializer { JQuery.CallbackFunction moveDropDownToBody() { return (event) -> { final JavaScriptObject properties = bodyDropdownProperties(event).getJavaScriptObject(); JQuery $ = jQuery(body()); JQuery css = jQuery(event.target).css(properties); JQuery detach = css.detach(); $.append(detach); }; } MenuInitializer(final Element menu,
                           final String dropDownClass); }
MenuInitializer { JQuery.CallbackFunction moveDropDownToBody() { return (event) -> { final JavaScriptObject properties = bodyDropdownProperties(event).getJavaScriptObject(); JQuery $ = jQuery(body()); JQuery css = jQuery(event.target).css(properties); JQuery detach = css.detach(); $.append(detach); }; } MenuInitializer(final Element menu,
                           final String dropDownClass); void init(); }
MenuInitializer { JQuery.CallbackFunction moveDropDownToBody() { return (event) -> { final JavaScriptObject properties = bodyDropdownProperties(event).getJavaScriptObject(); JQuery $ = jQuery(body()); JQuery css = jQuery(event.target).css(properties); JQuery detach = css.detach(); $.append(detach); }; } MenuInitializer(final Element menu,
                           final String dropDownClass); void init();  }