Package org.apache.tapestry5.dom

Examples of org.apache.tapestry5.dom.Document


    }

    @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, false);

        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, false);

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

        linker.updateDocument(document);

        assertEquals(document.toString(), readFile("add_script.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

    }

    @Test
    public void exception_if_missing_html_root_element_and_javascript()
    {
        Document document = new Document();

        document.newRootElement("not-html").text("not an HTML document");

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

        // Only checked if there's something to link.
View Full Code Here

    }

    @Test
    public void logged_error_if_missing_html_element_and_css()
    {
        Document document = new Document();

        document.newRootElement("not-html").text("not an HTML document");

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

        // Only checked if there's something to link.

        linker.addStylesheetLink(new StylesheetLink("style.css"));

        replay();

        linker.updateDocument(document);

        // Check that document is unchanged.

        assertEquals(document.toString(), "<not-html>not an HTML document</not-html>");

        verify();
    }
View Full Code Here

    }

    @Test
    public void missing_root_element_is_a_noop()
    {
        Document document = new Document();

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

        linker.addScriptLink("foo.js");
        linker.addScript(InitializationPriority.NORMAL, "doSomething();");
View Full Code Here

    }

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

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

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

        linker.addScriptLink("foo.js");
        linker.addScriptLink("bar/baz.js");
View Full Code Here

     * TAP5-446
     */
    @Test
    public void include_generator_meta() throws Exception
    {
        Document document = new Document(new XMLMarkupModel());

        document.newRootElement("html").element("body").element("p").text("Ready to be marked with generator meta.");

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

        linker.updateDocument(document);

View Full Code Here

     * TAP5-584
     */
    @Test
    public void omit_generator_meta_on_no_html_root() throws Exception
    {
        Document document = new Document(new XMLMarkupModel());

        document.newRootElement("no_html").text("Generator meta only added if root is html tag.");

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

        linker.updateDocument(document);

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.