Package org.apache.tapestry5.dom

Examples of org.apache.tapestry5.dom.Document


    }

    @Test
    public void duplicate_scripts_ignored_first_media_wins() throws Exception
    {
        Document document = new Document(new XMLMarkupModel());

        document.newRootElement("html").element("body").element("p").text("Ready to be updated with styles.");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3");

        linker.addStylesheetLink("foo.css", null);
        linker.addStylesheetLink("bar/baz.css", "print");
View Full Code Here


    }

    @Test
    public void existing_head_used_if_present() throws Exception
    {
        Document document = new Document(new XMLMarkupModel());

        document.newRootElement("html").element("head").comment("existing head").getParent()
                .element("body").text("body content");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3");

        linker.addStylesheetLink("foo.css", null);
View Full Code Here

    }

    @Test
    public void duplicate_script_links_ignored() throws Exception
    {
        Document document = new Document();

        document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3");

        for (int i = 0; i < 3; i++)
        {
View Full Code Here

    }

    @Test
    public void add_script() throws Exception
    {
        Document document = new Document();

        document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3");

        linker.addScript("doSomething();");
        linker.addScript("doSomethingElse();");

        linker.updateDocument(document);

        assertEquals(document.toString(), readFile("add_script.txt").trim());
    }
View Full Code Here

    }

    @Test
    public void add_script_in_development_mode() throws Exception
    {
        Document document = new Document();

        document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(false, true, "1.2.3");

        linker.addScriptLink("foo.js");

        linker.updateDocument(document);

        assertEquals(document.toString(), readFile("add_script_in_development_mode.txt").trim());
    }
View Full Code Here

     * Perhaps the linker should create the &lt;body&gt; element in this case? In the meantime,
     */
    @Test
    public void no_body_element() throws Exception
    {
        Document document = new Document(new XMLMarkupModel());

        document.newRootElement("html").element("notbody").element("p").text("Ready to be updated with scripts.");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3");

        linker.addScriptLink("foo.js");

View Full Code Here


    @Test
    public void script_written_raw() throws Exception
    {
        Document document = new Document();

        document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3");

        linker.addScript("for (var i = 0; i < 5; i++)  { doIt(i); }");

        linker.updateDocument(document);

        assertEquals(document.toString(), readFile("script_written_raw.txt").trim());
    }
View Full Code Here

    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));
View Full Code Here

                    element.getName()));
    }

    private Document getDocumentFromResponse()
    {
        Document result = response.getRenderedDocument();

        if (result == null)
            throw new RuntimeException(String.format("Render request '%s' did not result in a Document.", request.getPath()));

        return result;
View Full Code Here

    /** 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();
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.dom.Document

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.