use of elemental2.dom.HTMLBodyElement in project kie-wb-common by kiegroup.
the class DMNEditDRDToolboxActionTest method testOnMouseClick.
@Test
public void testOnMouseClick() throws NoSuchFieldException, IllegalAccessException {
final HTMLElement htmlElement = new HTMLElement();
htmlElement.style = new CSSStyleDeclaration();
final HTMLDocument htmlDocument = new HTMLDocument();
htmlDocument.body = new HTMLBodyElement();
final Field field = DomGlobal.class.getDeclaredField("document");
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(DomGlobal.class, htmlDocument);
when(drdContextMenu.getElement()).thenReturn(htmlElement);
dmnEditDRDToolboxAction.onMouseClick(canvasHandler, UUID, mouseClickEvent);
verify(drdContextMenu, times(1)).show(Mockito.<Collection>any());
}
use of elemental2.dom.HTMLBodyElement in project kie-wb-common by kiegroup.
the class PrintHelperTest method testWriteElementIntoDocument.
@Test
public void testWriteElementIntoDocument() {
final HTMLElement element = mock(HTMLElement.class);
final HTMLDocument document = mock(HTMLDocument.class);
final HTMLBodyElement body = mock(HTMLBodyElement.class);
final String elementHTML = "<html />";
final DOMTokenList classList = mock(DOMTokenList.class);
element.innerHTML = elementHTML;
document.body = body;
body.classList = classList;
helper.writeElementIntoDocument(element, document);
verify(document).open();
verify(document).write(elementHTML);
verify(document).close();
verify(classList).add(PREVIEW_SCREEN_CSS_CLASS);
}
Aggregations