use of play.twirl.api.Content in project civiform by seattle-uat.
the class BaseHtmlLayoutTest method addsDefaultContent.
@Test
public void addsDefaultContent() {
HtmlBundle bundle = layout.getBundle();
Content content = layout.render(bundle);
assertThat(content.body()).contains("<!DOCTYPE html><html lang=\"en\">");
assertThat(content.body()).contains("<link href=\"/assets/stylesheets/tailwind.css\" rel=\"stylesheet\">");
assertThat(content.body()).contains("<script src=\"/assets/javascripts/main.js\" type=\"text/javascript\"></script>");
assertThat(content.body()).contains("<script src=\"/assets/javascripts/radio.js\" type=\"text/javascript\"></script>");
assertThat(content.body()).contains("<main></main>");
}
use of play.twirl.api.Content in project civiform by seattle-uat.
the class HtmlBundleTest method rendersContentInOrder.
@Test
public void rendersContentInOrder() {
HtmlBundle bundle = new HtmlBundle();
bundle.addMainContent(div("One"));
bundle.addMainContent(div("Two"));
Content content = bundle.render();
assertThat(content.body()).contains("<main><div>One</div><div>Two</div></main>");
}
use of play.twirl.api.Content in project tutorials by eugenp.
the class ApplicationUnitTest method renderTemplate.
@Test
public void renderTemplate() {
Content html = views.html.index.render("Your new application is ready.");
assertEquals("text/html", html.contentType());
assertTrue(html.body().contains("Your new application is ready."));
}
use of play.twirl.api.Content in project civiform by seattle-uat.
the class BaseHtmlLayoutTest method canAddContentBefore.
@Test
public void canAddContentBefore() {
HtmlBundle bundle = new HtmlBundle();
// Add stylesheet before default.
Tag linkTag = link().withHref("moose.css").withRel("stylesheet");
bundle.addStylesheets(linkTag);
bundle = layout.getBundle(bundle);
Content content = layout.render(bundle);
assertThat(content.body()).contains("<!DOCTYPE html><html lang=\"en\">");
assertThat(content.body()).contains("<link href=\"moose.css\" rel=\"stylesheet\"><link" + " href=\"/assets/stylesheets/tailwind.css\" rel=\"stylesheet\">");
}
use of play.twirl.api.Content in project civiform by seattle-uat.
the class HtmlBundleTest method testSetTitle.
@Test
public void testSetTitle() {
HtmlBundle bundle = new HtmlBundle();
bundle.setTitle("My title");
Content content = bundle.render();
assertThat(content.body()).contains("<title>My title</title>");
}
Aggregations