Search in sources :

Example 6 with RouterLayout

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

the class NavigationStateRendererTest method getRouterLayoutForMulipleLayers.

@Test
public void getRouterLayoutForMulipleLayers() throws Exception {
    NavigationStateRenderer childRenderer = new NavigationStateRenderer(navigationStateFromTarget(ChildConfiguration.class));
    List<Class<? extends RouterLayout>> routerLayoutTypes = childRenderer.getRouterLayoutTypes(ChildConfiguration.class);
    Assert.assertEquals("Not all expected layouts were found", 2, routerLayoutTypes.size());
    Assert.assertEquals("Wrong class found as first in array", MiddleLayout.class, routerLayoutTypes.get(0));
    Assert.assertEquals("Wrong class found as second in array", RouteParentLayout.class, routerLayoutTypes.get(1));
}
Also used : RouterLayout(com.vaadin.flow.router.RouterLayout) NavigationStateRenderer(com.vaadin.flow.router.internal.NavigationStateRenderer) Test(org.junit.Test)

Example 7 with RouterLayout

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

the class NavigationStateRendererTest method getRouterLayoutForSingleParent.

@Test
public void getRouterLayoutForSingleParent() throws Exception {
    NavigationStateRenderer childRenderer = new NavigationStateRenderer(navigationStateFromTarget(SingleView.class));
    List<Class<? extends RouterLayout>> routerLayoutTypes = childRenderer.getRouterLayoutTypes(SingleView.class);
    Assert.assertEquals("Not all expected layouts were found", 1, routerLayoutTypes.size());
    Assert.assertEquals("Wrong class found", RouteParentLayout.class, routerLayoutTypes.get(0));
}
Also used : RouterLayout(com.vaadin.flow.router.RouterLayout) NavigationStateRenderer(com.vaadin.flow.router.internal.NavigationStateRenderer) Test(org.junit.Test)

Aggregations

RouterLayout (com.vaadin.flow.router.RouterLayout)7 UI (com.vaadin.flow.component.UI)3 NavigationStateRenderer (com.vaadin.flow.router.internal.NavigationStateRenderer)3 Test (org.junit.Test)3 HasElement (com.vaadin.flow.component.HasElement)2 Route (com.vaadin.flow.router.Route)2 InvalidRouteLayoutConfigurationException (com.vaadin.flow.server.InvalidRouteLayoutConfigurationException)2 Component (com.vaadin.flow.component.Component)1 Element (com.vaadin.flow.dom.Element)1 AfterNavigationEvent (com.vaadin.flow.router.AfterNavigationEvent)1 BeforeEnterEvent (com.vaadin.flow.router.BeforeEnterEvent)1 BeforeLeaveEvent (com.vaadin.flow.router.BeforeLeaveEvent)1 ContinueNavigationAction (com.vaadin.flow.router.BeforeLeaveEvent.ContinueNavigationAction)1 LocationChangeEvent (com.vaadin.flow.router.LocationChangeEvent)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1