use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method testRemoveChildView.
@Test
public void testRemoveChildView() {
new TestViewRenderer(TestView.class, ParentView.class, AnotherParentView.class).handle(dummyEvent);
ParentView parentView = (ParentView) ui.getInternals().getActiveViewChain().get(1);
new TestViewRenderer(ParentView.class, AnotherParentView.class).handle(dummyEvent);
Assert.assertEquals(0, parentView.getElement().getChildCount());
}
use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method reuseSingleView.
@Test
public void reuseSingleView() {
new TestViewRenderer(TestView.class).handle(dummyEvent);
List<View> firstChain = ui.getInternals().getActiveViewChain();
TestView view = (TestView) firstChain.get(0);
Assert.assertEquals(1, view.locations.size());
new TestViewRenderer(TestView.class).handle(dummyEvent);
Assert.assertEquals(2, view.locations.size());
List<View> secondChain = ui.getInternals().getActiveViewChain();
Assert.assertNotSame(firstChain, secondChain);
Assert.assertSame(view, secondChain.get(0));
}
use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method testReuseAllViews.
@Test
public void testReuseAllViews() {
new TestViewRenderer(TestView.class, ParentView.class, AnotherParentView.class).handle(dummyEvent);
try {
blockNewViewInstances.set(Boolean.TRUE);
// setChildView and view constructors throws if invoked
new TestViewRenderer(TestView.class, ParentView.class, AnotherParentView.class).handle(dummyEvent);
} finally {
blockNewViewInstances.remove();
}
}
use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method testViewTitle_titleAnnotation_titleUpdated.
@Test
public void testViewTitle_titleAnnotation_titleUpdated() {
new TestViewRenderer(AnotherTestView.class).handle(dummyEvent);
verifyViewTitleUpdate(ANOTHER_VIEW_TITLE);
}
use of com.vaadin.flow.router.legacy.TestViewRenderer in project flow by vaadin.
the class ViewRendererTest method testViewTitle_nullTitleReturned_noTitleSet.
@Test(expected = AssertionError.class)
public void testViewTitle_nullTitleReturned_noTitleSet() {
new TestViewRenderer(AnotherTestView.class).handle(dummyEvent);
verifyViewTitleUpdate(ANOTHER_VIEW_TITLE);
new TestViewRenderer(NullTitleView.class).handle(dummyEvent);
}
Aggregations