Search in sources :

Example 1 with RouteParam

use of com.vaadin.flow.router.RouteParam in project flow by vaadin.

the class UITest method navigateWithParameters_afterServerNavigation.

@Test
public void navigateWithParameters_afterServerNavigation() throws InvalidRouteConfigurationException {
    UI ui = new UI();
    initUI(ui, "", null);
    ui.navigate(FooBarParamNavigationTarget.class, new RouteParameters(new RouteParam("fooParam", "flu"), new RouteParam("barParam", "beer")));
    assertEquals("foo/flu/beer/bar", ui.getInternals().getActiveViewLocation().getPath());
    List<HasElement> chain = ui.getInternals().getActiveRouterTargetsChain();
    Assert.assertEquals(2, chain.size());
    MatcherAssert.assertThat(chain.get(0), CoreMatchers.instanceOf(FooBarParamNavigationTarget.class));
    MatcherAssert.assertThat(chain.get(1), CoreMatchers.instanceOf(FooBarParamParentNavigationTarget.class));
}
Also used : MockUI(com.vaadin.tests.util.MockUI) RouteParameters(com.vaadin.flow.router.RouteParameters) RouteParam(com.vaadin.flow.router.RouteParam) BootstrapHandlerTest(com.vaadin.flow.server.BootstrapHandlerTest) Test(org.junit.Test)

Aggregations

RouteParam (com.vaadin.flow.router.RouteParam)1 RouteParameters (com.vaadin.flow.router.RouteParameters)1 BootstrapHandlerTest (com.vaadin.flow.server.BootstrapHandlerTest)1 MockUI (com.vaadin.tests.util.MockUI)1 Test (org.junit.Test)1