use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterLinkTest method buildUrlWithRouter.
@Test
public void buildUrlWithRouter() {
Router router = new Router();
router.reconfigure(c -> c.setRoute("foo/{bar}", TestView.class));
String url = RouterLink.buildUrl(router, TestView.class, "asdf");
Assert.assertEquals("foo/asdf", url);
}
use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterConfigurationTest method testDefaultErrorView.
@Test(expected = IllegalArgumentException.class)
public void testDefaultErrorView() {
Router router = new Router();
assertErrorView(router, DefaultErrorView.class);
router.reconfigure(conf -> {
conf.setErrorView(null);
});
}
use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterConfigurationTest method getRoutesMultipleMappings.
@Test
public void getRoutesMultipleMappings() {
Router router = new Router();
router.reconfigure(conf -> {
conf.setRoute("route2", TestView.class);
conf.setRoute("route1", TestView.class);
});
assertRoutes(router, TestView.class, "route2", "route1");
}
use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterConfigurationTest method getRoutesNoMapping.
@Test
public void getRoutesNoMapping() {
Router router = new Router();
assertRoutes(router, TestView.class);
}
use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterConfigurationTest method testParentViewsWithParent.
@Test
public void testParentViewsWithParent() {
UI ui = new UI();
Router router = new Router();
router.reconfigure(conf -> {
conf.setRoute("route", TestView.class, ParentView.class);
conf.setParentView(ParentView.class, AnotherParentView.class);
});
router.navigate(ui, new Location("route"), NavigationTrigger.PROGRAMMATIC);
Assert.assertEquals(ParentView.class, router.getConfiguration().getParentView(TestView.class).get());
Assert.assertEquals(AnotherParentView.class, router.getConfiguration().getParentView(ParentView.class).get());
Assert.assertEquals(Arrays.asList(TestView.class, ParentView.class, AnotherParentView.class), getViewChainTypes(ui));
}
Aggregations