use of com.vaadin.flow.component.page.BodySize 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;}"));
}
Aggregations