Package org.apache.tapestry.dom

Examples of org.apache.tapestry.dom.Document


    public void verify_correct_dtds(String pageName, String expectedDTD, String checkText)
    {
        String appPackage = "org.apache.tapestry.integration.app2";
        String appName = "";
        PageTester tester = new PageTester(appPackage, appName);
        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...
View Full Code Here


    public void render()
    {
        String appPackage = "org.apache.tapestry.integration.app2";
        String appName = "";
        _tester = new PageTester(appPackage, appName);
        Document doc = _tester.renderPage("TestPageForLoop");
        assertTrue(doc.toString().contains("abcabcabc"));
        assertEquals(doc.getElementById("1").getChildText(), "xyz");
    }
View Full Code Here

    public void submit_form()
    {
        String appPackage = "org.apache.tapestry.integration.app2";
        String appName = "";
        _tester = new PageTester(appPackage, appName);
        Document doc = _tester.renderPage("TestPageForForm");
        Element form = doc.getElementById("form1");
        Map<String, String> fieldValues = CollectionFactory.newMap();
        fieldValues.put("t1", "hello");
        doc = _tester.submitForm(form, fieldValues);
        assertTrue(doc.toString().contains("You entered: hello"));
    }
View Full Code Here

    }

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

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

        DocumentHeadBuilder builder = new DocumentHeadBuilderImpl();

        builder.addScript("foo.js");
        builder.addScript("doSomething();");

        builder.updateDocument(document);

        assertEquals(document.toString(), "<not-html>not an HTML document</not-html>");
    }
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.");

        DocumentHeadBuilder builder = new DocumentHeadBuilderImpl();

        builder.addScriptLink("foo.js");
View Full Code Here

    }

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

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

        DocumentHeadBuilder builder = new DocumentHeadBuilderImpl();

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

    }

    @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.");

        DocumentHeadBuilder builder = new DocumentHeadBuilderImpl();

        builder.addStylesheetLink("foo.css", null);
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");

        DocumentHeadBuilder builder = new DocumentHeadBuilderImpl();

        builder.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.");

        DocumentHeadBuilder builder = new DocumentHeadBuilderImpl();

        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.");

        DocumentHeadBuilder builder = new DocumentHeadBuilderImpl();

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

        builder.updateDocument(document);

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

TOP

Related Classes of org.apache.tapestry.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.