Package org.apache.tapestry.dom

Examples of org.apache.tapestry.dom.Document


     * Perhaps the builder should create the <body> 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.");

        DocumentHeadBuilder builder = new DocumentHeadBuilderImpl();

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


    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 cleanup(Environment environment)
            {
                environment.pop(PageRenderSupport.class);

                Document document = environment.peek(Document.class);

                DocumentScriptBuilder builder = environment.pop(DocumentScriptBuilder.class);

                builder.updateDocument(document);
            }
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("TestPageForUnless");
        assertNotNull(doc.getElementById("2"));
        assertNotNull(doc.getElementById("4"));
        assertNotNull(doc.getElementById("6"));
        assertNotNull(doc.getElementById("7"));
        assertNull(doc.getElementById("1"));
        assertNull(doc.getElementById("3"));
        assertNull(doc.getElementById("5"));
        assertNull(doc.getElementById("8"));
    }
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("TestPageForIf");
        assertNotNull(doc.getElementById("1"));
        assertNotNull(doc.getElementById("3"));
        assertNotNull(doc.getElementById("5"));
        assertNotNull(doc.getElementById("8"));
        assertNull(doc.getElementById("2"));
        assertNull(doc.getElementById("4"));
        assertNull(doc.getElementById("6"));
        assertNull(doc.getElementById("7"));
    }
View Full Code Here

    {
    }

    public void cleanup(Environment environment)
    {
        Document document = environment.peek(Document.class);

        Element head = document.find("html/head");

        if (head == null)
            return;

        Asset asset = _assetSource.getClasspathAsset(
View Full Code Here

public class InjectStandardStylesheetCommandTest extends InternalBaseTestCase
{
    @Test
    public void no_head_element()
    {
        Document d = new Document();
        ThreadLocale tl = newThreadLocale();
        AssetSource source = newAssetSource();
        Environment env = newEnvironment();

        d.newRootElement("foo");
        String initial = d.toString();

        train_peek(env, Document.class, d);

        replay();

        new InjectStandardStylesheetCommand(tl, source).cleanup(env);

        assertEquals(d.toString(), initial, "Document structure should not change.");

        verify();
    }
View Full Code Here

    }

    @Test
    public void head_element_found()
    {
        Document d = new Document();
        ThreadLocale tl = newThreadLocale();
        AssetSource source = newAssetSource();
        Environment env = newEnvironment();
        Asset asset = newAsset();
        Locale l = Locale.FRENCH;

        d.newRootElement("html").element("head");

        train_peek(env, Document.class, d);
        train_getLocale(tl, l);

        train_getClasspathAsset(source, "org/apache/tapestry/default.css", l, asset);
        toClientURL(asset, "{clientURL}");

        replay();

        new InjectStandardStylesheetCommand(tl, source).cleanup(env);

        verify();

        assertEquals(
                d.toString(),
                "<html><head><link href=\"{clientURL}\" rel=\"stylesheet\" type=\"text/css\"></head></html>");
    }
View Full Code Here

    {
    }

    public void cleanup(Environment environment)
    {
        Document document = environment.peek(Document.class);

        Element head = document.find("html/head");

        if (head == null) return;

        head.elementAt(0, "link", "rel", "stylesheet", "type", "text/css", "href", _stylesheetAsset
                .toClientURL());
View Full Code Here

        this(new DefaultMarkupModel(), new NoOpComponentInvocationMap());
    }

    public MarkupWriterImpl(MarkupModel model, ComponentInvocationMap invocationMap)
    {
        _document = new Document(model);
        _invocationMap = invocationMap;
    }
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.