Package org.apache.tapestry5.dom

Examples of org.apache.tapestry5.dom.Document.newRootElement()


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

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

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true);

        linker.addScript("foo.js");
        linker.addScript("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);

        linker.addScriptLink("foo.js");
        linker.addScriptLink("bar/baz.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.");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true);

        linker.addStylesheetLink("foo.css", null);
        linker.addStylesheetLink("bar/baz.css", "print");
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.");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true);

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

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

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

        linker.addScript("doSomething();");
        linker.addScript("doSomethingElse();");
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);

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

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

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

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

TOP
Copyright © 2018 www.massapi.com. 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.