Class RouterLinkTester<T extends RouterLink>
java.lang.Object
com.vaadin.testbench.unit.ComponentTester<T>
com.vaadin.flow.component.routerlink.RouterLinkTester<T>
- Type Parameters:
T- component type
- All Implemented Interfaces:
Clickable<T>
Tester for RouterLink components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclick()Click the router-link for navigation.getHref()Gets the URL that the router-link links to.getPath()Gets the path for the router-link.Gets the query parameters for the router-link.getRoute()Gets the registered route class for the router-link.navigate()Navigate to the router-link target.Methods inherited from class com.vaadin.testbench.unit.ComponentTester
ensureComponentIsUsable, ensureComponentIsUsable, ensureVisible, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, isUsable, isUsable, notUsableReasons, notUsableReasons, roundTrip, setModal, setValueAsUserMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.testbench.unit.Clickable
click, click, middleClick, middleClick, rightClick, rightClick
-
Constructor Details
-
RouterLinkTester
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Details
-
getHref
Gets the URL that the router-link links to.- Returns:
- the href value, or empty string if no href has been set
-
getPath
Gets the path for the router-link. Returns an emptyStringif there is no corresponding navigation target.- Returns:
- a
Stringcontaining the navigation target path or empty if not present
-
getQueryParameters
Gets the query parameters for the router-link.- Returns:
- a
QueryParameterscontaining the navigation target's query parameters
-
getRoute
Gets the registered route class for the router-link. Returns an empty optional if there is no corresponding navigation target.- Returns:
- an
Optionalcontaining the navigation target class or empty if not found
-
click
public void click()Click the router-link for navigation. This is equivalent to callingnavigate(). For cases where you need to access the navigated view, usenavigate()instead as it returns the target view.
-