use of org.apache.tapestry5.dom.Document in project tapestry-5 by apache.
the class ASOTest method submit_aso.
@Test
public void submit_aso() {
tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
Document doc = tester.renderPage("TestPageForASO");
assertTrue(doc.toString().contains("bar"));
}
use of org.apache.tapestry5.dom.Document in project tapestry-5 by apache.
the class TestableResponseImplTest method http_headers.
@Test
public void http_headers() {
Document document = tester.renderPage(TestPageForHttpHeaders.class.getSimpleName());
assertTrue(document.toString().contains("Test page for HTTP headers"));
TestableResponse response = tester.getService(TestableResponse.class);
assertEquals(response.getHeader(TestPageForHttpHeaders.DATE_HEADER_NAME), 12345L);
assertEquals(response.getHeader(TestPageForHttpHeaders.INT_HEADER_NAME), 6789);
assertEquals(response.getHeader(TestPageForHttpHeaders.STRING_HEADER_NAME), "foo-bar-baz-barney");
}
use of org.apache.tapestry5.dom.Document in project tapestry-5 by apache.
the class MarkupWriterImplTest method single_root_element_only.
/**
* TAP5-349
*/
@Test
public void single_root_element_only() {
MarkupWriter w = new MarkupWriterImpl(new XMLMarkupModel());
w.element("root1");
w.end();
try {
w.element("root2");
unreachable();
} catch (RuntimeException ex) {
assertEquals(ex.getMessage(), "A document must have exactly one root element. Element <root1> is already the root element.");
}
}
use of org.apache.tapestry5.dom.Document in project gwtproject by treblereel.
the class ScriptInjectorTest method findScriptUrl.
/**
* Won't work for all urls, uses a regular expression match
*/
private JavaScriptObject findScriptUrl(JavaScriptObject wnd, String url) {
Document document = getDocumentFromWindow(wnd);
NodeList<Element> scripts = document.getElementsByTagName("script");
for (int i = 0; i < scripts.getLength(); i++) {
Element script = scripts.getAt(i);
if (script.getAttribute("src").matches(url)) {
return Js.cast(script);
}
}
return null;
}
use of org.apache.tapestry5.dom.Document in project gwtproject by treblereel.
the class ScriptInjectorTest method findScriptText.
private JavaScriptObject findScriptText(JavaScriptObject wnd, String text) {
Document document = getDocumentFromWindow(wnd);
NodeList<Element> scripts = document.getElementsByTagName("script");
for (int i = 0; i < scripts.getLength(); i++) {
Element script = scripts.getAt(i);
if (script.textContent.matches("^" + text)) {
return Js.cast(script);
}
}
return null;
}
Aggregations