Search in sources :

Example 6 with Document

use of org.apache.tapestry5.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)

Example 7 with Document

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

the class HeadTest method display.

@Test
public void display() {
    tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    Document doc = tester.renderPage("TestPageForHead");
    assertTrue(doc.toString().contains("OK"));
}
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 org.apache.tapestry5.dom.Document in project tapestry-5 by apache.

the class LocaleTest method prefer_canada_french.

@Test
public void prefer_canada_french() {
    tester.setPreferedLanguage(Locale.CANADA_FRENCH);
    Document doc = tester.renderPage("TestPageForLocale");
    assertEquals(doc.getElementById("id1").getChildMarkup(), "French page");
}
Also used : Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 9 with Document

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

the class LocaleTest method change_language_in_browser.

@Test
public void change_language_in_browser() {
    tester.setPreferedLanguage(Locale.ENGLISH);
    Document doc = tester.renderPage("TestPageForLocale");
    assertEquals(doc.getElementById("id1").getChildMarkup(), "English page");
    tester.setPreferedLanguage(Locale.CANADA_FRENCH);
    doc = tester.renderPage("TestPageForLocale");
    assertEquals(doc.getElementById("id1").getChildMarkup(), "French page");
}
Also used : Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 10 with Document

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

the class LocaleTest method no_preferred_language.

@Test
public void no_preferred_language() {
    Document doc = tester.renderPage("TestPageForLocale");
    assertEquals(doc.getElementById("id1").getChildMarkup(), "English page");
}
Also used : Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Aggregations

Document (org.apache.tapestry5.dom.Document)20 Test (org.testng.annotations.Test)19 PageTester (org.apache.tapestry5.test.PageTester)11 Element (org.apache.tapestry5.dom.Element)8 MarkupWriter (org.apache.tapestry5.MarkupWriter)4 Document (elemental2.dom.Document)2 Element (elemental2.dom.Element)2 XMLMarkupModel (org.apache.tapestry5.dom.XMLMarkupModel)2 IOException (java.io.IOException)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 XPathExpressionException (javax.xml.xpath.XPathExpressionException)1 TestPageForActionLinkWithStream (org.apache.tapestry5.integration.app2.pages.TestPageForActionLinkWithStream)1 TestPageForHttpHeaders (org.apache.tapestry5.integration.app2.pages.TestPageForHttpHeaders)1 Page (org.apache.tapestry5.internal.structure.Page)1 RenderCommand (org.apache.tapestry5.runtime.RenderCommand)1 ComponentLibraryInfo (org.apache.tapestry5.services.ComponentLibraryInfo)1 Test (org.junit.Test)1 Document (org.w3c.dom.Document)1