use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class AbstractDnDUnitTest method testExtension_staticApiNotIosNotCompatibilityMode_connectorDependencyAndPolyfillNotAddedDynamically.
@Test
public void testExtension_staticApiNotIosNotCompatibilityMode_connectorDependencyAndPolyfillNotAddedDynamically() {
ui.getInternals().getDependencyList().clearPendingSendToClient();
RouterLink component = new RouterLink();
ui.add(component);
runStaticCreateMethodForExtension(component);
DependencyList dependencyList = ui.getInternals().getDependencyList();
Collection<Dependency> pendingSendToClient = dependencyList.getPendingSendToClient();
Assert.assertEquals("No dependencies should be added", 0, pendingSendToClient.size());
}
use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class DropTargetTest method testDropTarget_notAttachedToUIAndReceivesDropEvent_throws.
@Test(expected = IllegalStateException.class)
public void testDropTarget_notAttachedToUIAndReceivesDropEvent_throws() {
RouterLink component = new RouterLink();
DropTarget<RouterLink> dropTarget = DropTarget.create(component);
DropEvent<RouterLink> dropEvent = new DropEvent<>(component, true, "all");
ComponentUtil.fireEvent(component, dropEvent);
}
use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class NavigationRpcHandlerTest method handleRouterLinkClick_uiIsInert_navigationNotTriggered.
@Test
public void handleRouterLinkClick_uiIsInert_navigationNotTriggered() {
ui.addModal(new RouterLink());
ui.getInternals().getStateTree().collectChanges(nodeChange -> {
});
invocation.put(JsonConstants.RPC_NAVIGATION_ROUTERLINK, true);
rpcHandler.handle(ui, invocation);
Mockito.verifyNoInteractions(historyStateChangeHandler);
}
use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class NavigationRpcHandlerTest method setup.
@Before
public void setup() {
ui = new UI();
historyStateChangeHandler = Mockito.mock(History.HistoryStateChangeHandler.class);
ui.getPage().getHistory().setHistoryStateChangeHandler(historyStateChangeHandler);
ui.add(new RouterLink());
rpcHandler = new NavigationRpcHandler();
invocation = Json.createObject();
invocation.put(JsonConstants.RPC_NAVIGATION_LOCATION, "foo");
}
use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class ShortcutsTest method setShortcutListenOnElementLocatorJs_storesLocatorOnComponentData.
@Test
public void setShortcutListenOnElementLocatorJs_storesLocatorOnComponentData() {
final RouterLink routerLink = new RouterLink();
final String locator = "foobar";
final Registration registration = Shortcuts.setShortcutListenOnElement(locator, routerLink);
Assert.assertEquals(locator, ComponentUtil.getData(routerLink, Shortcuts.ELEMENT_LOCATOR_JS_KEY));
registration.remove();
Assert.assertNull(ComponentUtil.getData(routerLink, Shortcuts.ELEMENT_LOCATOR_JS_KEY));
}
Aggregations