@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); 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); }
JSONObject bodyDropdownProperties(final JQueryEvent e) { final JSONObject jsonObject = makeJsonObject(); jsonObject.put("position", new JSONString("absolute")); jsonObject.put("left", new JSONNumber(offsetLeft(e.target))); jsonObject.put("top", new JSONNumber(offsetTop(e.target))); jsonObject.put("z-index", new JSONNumber(1051)); return jsonObject; }
MenuInitializer { JSONObject bodyDropdownProperties(final JQueryEvent e) { final JSONObject jsonObject = makeJsonObject(); jsonObject.put("position", new JSONString("absolute")); jsonObject.put("left", new JSONNumber(offsetLeft(e.target))); jsonObject.put("top", new JSONNumber(offsetTop(e.target))); jsonObject.put("z-index", new JSONNumber(1051)); return jsonObject; } }
MenuInitializer { JSONObject bodyDropdownProperties(final JQueryEvent e) { final JSONObject jsonObject = makeJsonObject(); jsonObject.put("position", new JSONString("absolute")); jsonObject.put("left", new JSONNumber(offsetLeft(e.target))); jsonObject.put("top", new JSONNumber(offsetTop(e.target))); jsonObject.put("z-index", new JSONNumber(1051)); return jsonObject; } MenuInitializer(final Element menu,
                           final String dropDownClass); }
MenuInitializer { JSONObject bodyDropdownProperties(final JQueryEvent e) { final JSONObject jsonObject = makeJsonObject(); jsonObject.put("position", new JSONString("absolute")); jsonObject.put("left", new JSONNumber(offsetLeft(e.target))); jsonObject.put("top", new JSONNumber(offsetTop(e.target))); jsonObject.put("z-index", new JSONNumber(1051)); return jsonObject; } MenuInitializer(final Element menu,
                           final String dropDownClass); void init(); }
MenuInitializer { JSONObject bodyDropdownProperties(final JQueryEvent e) { final JSONObject jsonObject = makeJsonObject(); jsonObject.put("position", new JSONString("absolute")); jsonObject.put("left", new JSONNumber(offsetLeft(e.target))); jsonObject.put("top", new JSONNumber(offsetTop(e.target))); jsonObject.put("z-index", new JSONNumber(1051)); return jsonObject; } MenuInitializer(final Element menu,
                           final String dropDownClass); void init();  }