Package org.ocpsoft.rewrite.transform.markup

Examples of org.ocpsoft.rewrite.transform.markup.HtmlDocumentBuilder


{

   @Test
   public void shouldCreateHtml5Doctype()
   {
      String result = new HtmlDocumentBuilder().build(null);
      assertThat(result, startsWith("<!DOCTYPE html>"));
   }
View Full Code Here


   }

   @Test
   public void shouldCreateHeadElement()
   {
      String result = new HtmlDocumentBuilder().build(null);
      assertThat(result, containsString("<head>"));
      assertThat(result, containsString("</head>"));
   }
View Full Code Here

   }

   @Test
   public void shouldCreateBody()
   {
      String result = new HtmlDocumentBuilder().build(null);
      assertThat(result, containsString("<body>"));
      assertThat(result, containsString("</body>"));
   }
View Full Code Here

   }

   @Test
   public void shouldAddNoTitleByDefault()
   {
      String result = new HtmlDocumentBuilder().build(null);
      assertThat(result, not(containsString("<title>")));
      assertThat(result, not(containsString("</title>")));
   }
View Full Code Here

   }

   @Test
   public void shouldAddTitleIfTitleIsSet()
   {
      String result = new HtmlDocumentBuilder().withTitle("foo").build(null);
      assertThat(result, containsString("<title>foo</title>"));
   }
View Full Code Here

   }

   @Test
   public void shouldAddNoStylesheetByDefault()
   {
      String result = new HtmlDocumentBuilder().build(null);
      assertThat(result, not(containsString("<link")));
   }
View Full Code Here

   }

   @Test
   public void shouldAddNoHeaderInjectionByDefault()
   {
      String result = new HtmlDocumentBuilder().build(null);
      Assert.assertEquals("<!DOCTYPE html>\n" +
               "<html>\n" +
               "<head>\n" +
               "</head>\n" +
               "<body>\n" +
View Full Code Here

   }

   @Test
   public void shouldAddStylesheetIfFileWasAdded()
   {
      String result = new HtmlDocumentBuilder().addStylesheet("styles.css").build(null);
      assertThat(result, containsString("<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">"));
   }
View Full Code Here

   }

   @Test
   public void shouldAddMultipleStylesheets()
   {
      String result = new HtmlDocumentBuilder()
               .addStylesheet("foo.css")
               .addStylesheet("bar.css")
               .build(null);
      assertThat(result, containsString("<link rel=\"stylesheet\" type=\"text/css\" href=\"foo.css\">"));
      assertThat(result, containsString("<link rel=\"stylesheet\" type=\"text/css\" href=\"bar.css\">"));
View Full Code Here

   }

   @Test
   public void shouldAddBody()
   {
      String result = new HtmlDocumentBuilder().build("content");
      assertThat(result, containsString("<body>\ncontent\n</body>"));
   }
View Full Code Here

TOP

Related Classes of org.ocpsoft.rewrite.transform.markup.HtmlDocumentBuilder

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.