Search in sources :

Example 41 with Document

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

the class OverrideMethodsTest method override_abstract_methods.

/**
 * TAP5-901
 */
@Test
public void override_abstract_methods() {
    PageTester tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    try {
        Document doc = tester.renderPage("OverrideAbstractMethods");
        assertEquals("6", doc.getElementById("length").getChildMarkup());
    } finally {
        tester.shutdown();
    }
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 42 with Document

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

the class PageNameMetaInjector method renderMarkup.

public void renderMarkup(MarkupWriter writer, MarkupRenderer delegate) {
    delegate.renderMarkup(writer);
    String pageName = globals.getActivePageName();
    Document document = writer.getDocument();
    Element element = document.find("html/head");
    if (element != null) {
        element.element("meta", "name", "tapestry-page-name", "content", pageName);
    }
}
Also used : Element(org.apache.tapestry5.dom.Element) Document(org.apache.tapestry5.dom.Document)

Example 43 with Document

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

the class PageTester method renderPage.

/**
 * Renders a page specified by its name.
 *
 * @param pageName
 *         The name of the page to be rendered.
 * @return The DOM created. Typically you will assert against it.
 */
public Document renderPage(String pageName) {
    renderPageAndReturnResponse(pageName);
    Document result = response.getRenderedDocument();
    if (result == null)
        throw new RuntimeException(String.format("Render of page '%s' did not result in a Document.", pageName));
    return result;
}
Also used : Document(org.apache.tapestry5.dom.Document)

Example 44 with Document

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

the class TestableResponseImplTest method action_link.

@Test
public void action_link() {
    Document document = tester.renderPage(TestPageForActionLinkWithStream.class.getSimpleName());
    Element link = document.getElementById("mylink");
    assertNotNull(link);
    TestableResponse response = tester.clickLinkAndReturnResponse(link);
    assertEquals(response.getOutput(), "<html><body>Rendered with TextStreamResponse</body></html>");
}
Also used : TestPageForActionLinkWithStream(org.apache.tapestry5.integration.app2.pages.TestPageForActionLinkWithStream) Element(org.apache.tapestry5.dom.Element) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 45 with Document

use of elemental2.dom.Document in project console by hal.

the class RootView method setInSlot.

@Override
public void setInSlot(Object slot, IsWidget content) {
    if (slot == SLOT_HEADER_CONTENT || slot == SLOT_FOOTER_CONTENT) {
        // single elements only!
        HTMLElement element = content instanceof IsElement ? ((IsElement) content).element() : Widgets.element(content);
        slots.put(slot, element);
        if (!initialized && slots.containsKey(SLOT_HEADER_CONTENT) && slots.containsKey(SLOT_FOOTER_CONTENT)) {
            // append all three building blocks to the document body
            document.body.appendChild(slots.get(SLOT_HEADER_CONTENT));
            document.body.appendChild(rootContainer);
            document.body.appendChild(slots.get(SLOT_FOOTER_CONTENT));
            initialized = true;
        }
    } else if (slot == Slots.MAIN) {
        Elements.removeChildrenFrom(rootContainer);
        appendContent(content);
    } else {
        logger.warn("Unknown slot {}. Delegate to super.setInSlot()", slot);
        super.setInSlot(slot, content);
    }
}
Also used : HTMLElement(elemental2.dom.HTMLElement) IsElement(org.jboss.gwt.elemento.core.IsElement)

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