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();
}
}
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);
}
}
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;
}
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>");
}
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);
}
}
Aggregations