Search in sources :

Example 51 with Location

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

the class UITest method locationAfterClientNavigation.

@Test
public void locationAfterClientNavigation() {
    UI ui = createAndInitTestUI("");
    History history = ui.getPage().getHistory();
    history.getHistoryStateChangeHandler().onHistoryStateChange(new HistoryStateChangeEvent(history, null, new Location("foo/bar"), NavigationTrigger.HISTORY));
    assertEquals("foo/bar", ui.getInternals().getActiveViewLocation().getPath());
}
Also used : HistoryStateChangeEvent(com.vaadin.flow.component.page.History.HistoryStateChangeEvent) History(com.vaadin.flow.component.page.History) Location(com.vaadin.flow.router.Location) Test(org.junit.Test)

Aggregations

Location (com.vaadin.flow.router.Location)51 Test (org.junit.Test)40 UI (com.vaadin.flow.component.UI)15 Router (com.vaadin.flow.router.legacy.Router)15 NavigationEvent (com.vaadin.flow.router.NavigationEvent)10 NavigationHandler (com.vaadin.flow.router.NavigationHandler)8 RouterConfiguration (com.vaadin.flow.router.legacy.RouterConfiguration)7 HistoryStateChangeEvent (com.vaadin.flow.component.page.History.HistoryStateChangeEvent)6 TestView (com.vaadin.flow.router.legacy.ViewRendererTest.TestView)6 NavigationTrigger (com.vaadin.flow.router.NavigationTrigger)5 QueryParameters (com.vaadin.flow.router.QueryParameters)5 DefaultErrorView (com.vaadin.flow.router.legacy.DefaultErrorView)5 VaadinRequest (com.vaadin.flow.server.VaadinRequest)5 VaadinResponse (com.vaadin.flow.server.VaadinResponse)5 Optional (java.util.Optional)4 CurrentInstance (com.vaadin.flow.internal.CurrentInstance)3 RouterInterface (com.vaadin.flow.router.RouterInterface)3 ImmutableRouterConfiguration (com.vaadin.flow.router.legacy.ImmutableRouterConfiguration)3 Resolver (com.vaadin.flow.router.legacy.Resolver)3 RouteSegmentVisitor (com.vaadin.flow.router.legacy.RouteLocation.RouteSegmentVisitor)3