use of org.jsoup.select.Elements in project flow by vaadin.
the class BootstrapHandlerTest method page_configurator_link_shorthands_are_added_correctly.
// 3203
@Test
public void page_configurator_link_shorthands_are_added_correctly() throws InvalidRouteConfigurationException {
initUI(testUI, createVaadinRequest(), Collections.singleton(InitialPageConfiguratorLinkShorthands.class));
Document page = BootstrapHandler.getBootstrapPage(new BootstrapContext(request, null, session, testUI));
Elements allElements = page.head().getAllElements();
Assert.assertEquals("<link href=\"icons/favicon.ico\" rel=\"shortcut icon\">", allElements.get(allElements.size() - 2).toString());
Assert.assertEquals("<link href=\"icons/icon-192.png\" rel=\"icon\" sizes=\"192x192\">", allElements.get(allElements.size() - 1).toString());
}
use of org.jsoup.select.Elements in project flow by vaadin.
the class BootstrapHandlerTest method page_configurator_inlines_javascript_from_content.
// 3036
@Test
public void page_configurator_inlines_javascript_from_content() throws InvalidRouteConfigurationException {
initUI(testUI, createVaadinRequest(), Collections.singleton(InitialPageConfiguratorPrependContents.class));
Document page = BootstrapHandler.getBootstrapPage(new BootstrapContext(request, null, session, testUI));
Elements allElements = page.head().getAllElements();
// Note element 0 is the full head element.
assertStringEquals("Content javascript should have been prepended to head element", "<script type=\"text/javascript\">window.messages = window.messages || [];\n" + "window.messages.push(\"content script\");</script>", allElements.get(1).toString());
}
use of org.jsoup.select.Elements in project flow by vaadin.
the class BootstrapHandlerTest method headHasMetaTags.
@Test
public void headHasMetaTags() throws Exception {
initUI(testUI, createVaadinRequest());
Document page = BootstrapHandler.getBootstrapPage(new BootstrapContext(request, null, session, testUI));
Element head = page.head();
Elements metas = head.getElementsByTag("meta");
Assert.assertEquals(2, metas.size());
Element meta = metas.get(0);
assertEquals("Content-Type", meta.attr("http-equiv"));
assertEquals("text/html; charset=utf-8", meta.attr("content"));
meta = metas.get(1);
assertEquals("X-UA-Compatible", meta.attr("http-equiv"));
assertEquals("IE=edge", meta.attr("content"));
}
use of org.jsoup.select.Elements in project flow by vaadin.
the class BootstrapHandlerTest method body_size_adds_styles_for_body.
// 2344
@Test
public void body_size_adds_styles_for_body() throws InvalidRouteConfigurationException {
initUI(testUI, createVaadinRequest(), Collections.singleton(BodySizeAnnotated.class));
Document page = BootstrapHandler.getBootstrapPage(new BootstrapContext(request, null, session, testUI));
Elements allElements = page.head().getAllElements();
Optional<Element> styleTag = allElements.stream().filter(element -> element.tagName().equals("style")).findFirst();
Assert.assertTrue("Expected a style element in head.", styleTag.isPresent());
Assert.assertTrue("The first style tag should start with body style from @BodySize", styleTag.get().toString().startsWith("<style type=\"text/css\">body {height:100vh;width:100vw;margin:0;}"));
}
use of org.jsoup.select.Elements in project flow by vaadin.
the class BootstrapHandlerTest method page_configurator_inlines_prepend_javascript_from_file.
// 3036
@Test
public void page_configurator_inlines_prepend_javascript_from_file() throws InvalidRouteConfigurationException {
initUI(testUI, createVaadinRequest(), Collections.singleton(InitialPageConfiguratorPrependFile.class));
Document page = BootstrapHandler.getBootstrapPage(new BootstrapContext(request, null, session, testUI));
Elements allElements = page.head().getAllElements();
// Note element 0 is the full head element.
assertStringEquals("Content javascript should have been prepended to head element", "<script type=\"text/javascript\">window.messages = window.messages || [];\n" + "window.messages.push(\"inline.js\");</script>", allElements.get(1).toString());
}
Aggregations