use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method testViewTitle_titleSetPreviouslyButNotDefinedForNextView_emptyTitleSet.
@Test
public void testViewTitle_titleSetPreviouslyButNotDefinedForNextView_emptyTitleSet() {
new TestViewRenderer(AnotherTestView.class).handle(dummyEvent);
verifyViewTitleUpdate(ANOTHER_VIEW_TITLE);
new TestViewRenderer(TestView.class).handle(dummyEvent);
verifyViewTitleUpdate("");
}
use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method showNestedView.
@Test
public void showNestedView() {
new TestViewRenderer(TestView.class, ParentView.class, AnotherParentView.class).handle(dummyEvent);
List<View> viewChain = ui.getInternals().getActiveViewChain();
Assert.assertEquals(3, viewChain.size());
Assert.assertEquals(Arrays.asList(TestView.class, ParentView.class, AnotherParentView.class), viewChain.stream().map(Object::getClass).collect(Collectors.toList()));
Element element = null;
for (View view : viewChain) {
Assert.assertEquals(Arrays.asList(dummyEvent.getLocation()), ((TestView) view).locations);
Element viewElement = view.getElement();
if (element != null) {
Assert.assertEquals(viewElement, element.getParent());
}
element = viewElement;
}
Assert.assertEquals(ui.getElement(), element.getParent());
Assert.assertEquals(1, ui.getElement().getChildCount());
}
use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method testViewDynamicTitle.
@Test
public void testViewDynamicTitle() {
new TestViewRenderer(DynamicTitleView.class).handle(dummyEvent);
verifyViewTitleUpdate(DYNAMIC_VIEW_TITLE);
}
use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method testViewReroute.
@Test
public void testViewReroute() {
TestViewRenderer renderer = new TestViewRenderer(RerouteView.class);
int statusCode = renderer.handle(dummyEvent);
Assert.assertEquals(404, statusCode);
List<View> activeViewChain = ui.getInternals().getActiveViewChain();
Assert.assertEquals(1, activeViewChain.size());
Assert.assertSame(DefaultErrorView.class, activeViewChain.get(0).getClass());
}
use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method testViewTitle_onlyParentHasTitle_defaultTitleUsed.
@Test
public void testViewTitle_onlyParentHasTitle_defaultTitleUsed() {
new TestViewRenderer(TestView.class, ParentView.class).handle(dummyEvent);
verifyViewTitleUpdate("");
}
Aggregations