Search in sources :

Example 6 with Document

use of elemental2.dom.Document in project gwtproject by treblereel.

the class RichTextAreaImplStandard method queryCommandValueAssumingFocus.

String queryCommandValueAssumingFocus(String cmd) {
    HTMLIFrameElement iframe = Js.uncheckedCast(elem);
    Document document = Js.uncheckedCast(Js.asPropertyMap(iframe.contentWindow).get("document"));
    return ((QueryCommandValue) Js.uncheckedCast(Js.asPropertyMap(document).get("queryCommandValue"))).onInvoke(cmd);
}
Also used : HTMLIFrameElement(elemental2.dom.HTMLIFrameElement) Document(org.gwtproject.dom.client.Document)

Example 7 with Document

use of elemental2.dom.Document in project tapestry-5 by apache.

the class TemplateInContextTest method template_in_web_context.

@Test
public void template_in_web_context() {
    tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME, "src/test/app2");
    Document doc = tester.renderPage("TestPageForTemplateInContext");
    assertTrue(doc.toString().contains("How are you?"));
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 8 with Document

use of elemental2.dom.Document in project tapestry-5 by apache.

the class UnlessTest method render.

@Test
public void render() {
    tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    Document doc = tester.renderPage("TestPageForUnless");
    assertNotNull(doc.getElementById("2"));
    assertNotNull(doc.getElementById("4"));
    assertNotNull(doc.getElementById("6"));
    assertNotNull(doc.getElementById("7"));
    assertNull(doc.getElementById("1"));
    assertNull(doc.getElementById("3"));
    assertNull(doc.getElementById("5"));
    assertNull(doc.getElementById("8"));
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 9 with Document

use of elemental2.dom.Document in project tapestry-5 by apache.

the class PageTesterTest method on_activate_chain_is_followed.

@Test(dataProvider = "testers")
public void on_activate_chain_is_followed(PageTester tester) {
    Document launchDoc = tester.renderPage("Launch");
    Map<String, String> parameters = Collections.emptyMap();
    // Submit the form, which will then skip through Intermediate and
    // arrive at Final.
    Document finalDoc = tester.submitForm(launchDoc.getElementById("form"), parameters);
    assertEquals(finalDoc.getElementById("page-name").getChildMarkup(), "Final");
}
Also used : Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 10 with Document

use of elemental2.dom.Document in project tapestry-5 by apache.

the class DTDTest method verify_correct_dtds.

@Test(dataProvider = "dtd_page_provider")
public void verify_correct_dtds(String pageName, String expectedDTD, String checkText) {
    PageTester tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    Document doc = tester.renderPage(pageName);
    String txt = doc.toString();
    // use startsWith to make sure the DTD is getting into the right spot.
    assertTrue(txt.startsWith(expectedDTD));
    // we should also make sure that the other DTD's don't appear anywhere else...
    checkOtherDTD(txt, expectedDTD);
    // spot check the body of the pages to make sure they correctly rendered...
    // they should have, based on the unit tests for template rendering, but...
    assertTrue(txt.contains(checkText));
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Aggregations

Document (org.apache.tapestry5.dom.Document)20 Test (org.testng.annotations.Test)17 PageTester (org.apache.tapestry5.test.PageTester)11 Test (org.junit.Test)10 HTMLDocument (elemental2.dom.HTMLDocument)9 HTMLElement (elemental2.dom.HTMLElement)9 HTMLIFrameElement (elemental2.dom.HTMLIFrameElement)9 HTMLBodyElement (elemental2.dom.HTMLBodyElement)5 Element (elemental2.dom.Element)4 Element (org.apache.tapestry5.dom.Element)4 DOMTokenList (elemental2.dom.DOMTokenList)3 JsPropertyMap (jsinterop.base.JsPropertyMap)3 Document (org.gwtproject.dom.client.Document)3 Element (org.gwtproject.dom.client.Element)3 InputElement (org.gwtproject.dom.client.InputElement)3 Document (elemental2.dom.Document)2 File (elemental2.dom.File)2 Window (elemental2.dom.Window)2 Field (java.lang.reflect.Field)2 List (java.util.List)2