use of elemental2.dom.Document 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);
}
use of elemental2.dom.Document in project kie-wb-common by kiegroup.
the class DNDListComponentViewTest method testCreateItem.
@Test
public void testCreateItem() {
final HTMLDocument document = mock(HTMLDocument.class);
final HTMLElement expectedItem = mock(HTMLElement.class);
final HTMLElement htmlElement = mock(HTMLElement.class);
final HTMLElement grip = mock(HTMLElement.class);
final HTMLElement i0 = mock(HTMLElement.class);
final HTMLElement i1 = mock(HTMLElement.class);
DNDListDOMHelper.Factory.DOCUMENT = document;
expectedItem.classList = mock(DOMTokenList.class);
grip.classList = mock(DOMTokenList.class);
i0.classList = mock(DOMTokenList.class);
i1.classList = mock(DOMTokenList.class);
when(document.createElement("div")).thenReturn(expectedItem, grip);
when(document.createElement("i")).thenReturn(i0, i1);
final HTMLElement actualItem = view.createItem(htmlElement);
verify(actualItem).appendChild(grip);
verify(actualItem).appendChild(htmlElement);
verify(actualItem.classList).add(DRAGGABLE);
assertEquals(expectedItem, actualItem);
}
use of elemental2.dom.Document in project kie-wb-common by kiegroup.
the class DNDListDOMHelperTest method testCreateGripElement.
@Test
public void testCreateGripElement() {
final HTMLDocument document = mock(HTMLDocument.class);
final HTMLElement expectedGrip = mock(HTMLElement.class);
final HTMLElement firstI = mock(HTMLElement.class);
final HTMLElement secondI = mock(HTMLElement.class);
final String div = "div";
final String i = "i";
DNDListDOMHelper.Factory.DOCUMENT = document;
expectedGrip.classList = mock(DOMTokenList.class);
firstI.classList = mock(DOMTokenList.class);
secondI.classList = mock(DOMTokenList.class);
when(document.createElement(div)).thenReturn(expectedGrip);
when(document.createElement(i)).thenReturn(firstI, secondI);
final HTMLElement actualGrip = createGripElement();
verify(expectedGrip).appendChild(firstI);
verify(expectedGrip).appendChild(secondI);
verify(expectedGrip.classList).add(GRIP);
verify(firstI.classList).add(ICON_CLASS);
verify(secondI.classList).add(ICON_CLASS);
verify(firstI.classList).add(ELLIPSIS_CLASS);
verify(secondI.classList).add(ELLIPSIS_CLASS);
assertEquals(expectedGrip, actualGrip);
}
use of elemental2.dom.Document in project gwtproject by treblereel.
the class RichTextAreaImplStandard method queryCommandStateAssumingFocus.
boolean queryCommandStateAssumingFocus(String cmd) {
HTMLIFrameElement iframe = Js.uncheckedCast(elem);
Document document = Js.uncheckedCast(Js.asPropertyMap(iframe.contentWindow).get("document"));
return ((QueryCommandState) Js.uncheckedCast(Js.asPropertyMap(document).get("queryCommandState"))).onInvoke(cmd);
}
use of elemental2.dom.Document in project gwtproject by treblereel.
the class RichTextAreaImplStandard method setEnabledImpl.
protected void setEnabledImpl(boolean enabled) {
HTMLIFrameElement iframe = Js.uncheckedCast(elem);
((JsPropertyMap) ((JsPropertyMap) iframe.contentWindow).get("document")).set("designMode", enabled ? "On" : "Off");
}
Aggregations