use of org.uberfire.client.views.pfly.selectpicker.JQueryEvent in project kie-wb-common by kiegroup.
the class MenuInitializerTest method testBodyDropdownProperties.
@Test
public void testBodyDropdownProperties() {
final JQueryEvent event = mock(JQueryEvent.class);
final HTMLElement target = mock(HTMLElement.class);
final double left = 1;
final double top = 1;
final double zIndex = 1051;
final JSONObject expectedJSONObject = mock(JSONObject.class);
// Mock "JSONObject" since it relies on a native implementation.
doReturn(expectedJSONObject).when(initializer).makeJsonObject();
event.target = target;
doReturn(left).when(initializer).offsetLeft(target);
doReturn(top).when(initializer).offsetTop(target);
doReturn(top).when(initializer).offsetTop(target);
final JSONObject actualJSONObject = initializer.bodyDropdownProperties(event);
verify(expectedJSONObject).put("position", new JSONString("absolute"));
verify(expectedJSONObject).put("left", new JSONNumber(left));
verify(expectedJSONObject).put("top", new JSONNumber(top));
verify(expectedJSONObject).put("z-index", new JSONNumber(zIndex));
assertEquals(expectedJSONObject, actualJSONObject);
}
use of org.uberfire.client.views.pfly.selectpicker.JQueryEvent 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.JQueryEvent 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);
}
Aggregations