use of com.vaadin.flow.server.communication.JavaScriptBootstrapHandler.JavaScriptBootstrapContext in project flow by vaadin.
the class BootstrapContextTest method getPushAnnotation_routeTargetPresents_pushFromTheClassDefinitionIsUsed.
@Test
public void getPushAnnotation_routeTargetPresents_pushFromTheClassDefinitionIsUsed() {
ui.getInternals().getRouter().getRegistry().setRoute("foo", MainView.class, Collections.emptyList());
Mockito.when(request.getParameter(ApplicationConstants.REQUEST_LOCATION_PARAMETER)).thenReturn("foo");
BootstrapContext context = new JavaScriptBootstrapContext(request, Mockito.mock(VaadinResponse.class), ui, callback);
Optional<Push> push = context.getPageConfigurationAnnotation(Push.class);
Assert.assertTrue(push.isPresent());
Push pushAnnotation = push.get();
Assert.assertEquals(PushMode.MANUAL, pushAnnotation.value());
Assert.assertEquals(Transport.LONG_POLLING, pushAnnotation.transport());
}
use of com.vaadin.flow.server.communication.JavaScriptBootstrapHandler.JavaScriptBootstrapContext in project flow by vaadin.
the class BootstrapContextTest method getPushAnnotation_routeTargetPresents_pushDefinedOnParentLayout_pushFromTheClassDefinitionIsUsed.
@Test
public void getPushAnnotation_routeTargetPresents_pushDefinedOnParentLayout_pushFromTheClassDefinitionIsUsed() {
ui.getInternals().getRouter().getRegistry().setRoute("foo", OtherView.class, Collections.singletonList(MainView.class));
Mockito.when(request.getParameter(ApplicationConstants.REQUEST_LOCATION_PARAMETER)).thenReturn("foo");
BootstrapContext context = new JavaScriptBootstrapContext(request, Mockito.mock(VaadinResponse.class), ui, callback);
Optional<Push> push = context.getPageConfigurationAnnotation(Push.class);
Assert.assertTrue(push.isPresent());
Push pushAnnotation = push.get();
Assert.assertEquals(PushMode.MANUAL, pushAnnotation.value());
Assert.assertEquals(Transport.LONG_POLLING, pushAnnotation.transport());
}
Aggregations