You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**
*
* Tester for RouterLink components.
*
* @param <T>
* component type
*/
@Tests(RouterLink.class)
public class RouterLinkTester<T extends RouterLink> extends ComponentTester<T> {
/**
* Wrap given component for testing.
*
* @param component target component
*/
public RouterLinkTester(T component) {
super(component);
}
/**
* Gets the registered route class for the router-link.
* Returns an empty optional if there is no corresponding navigation target.
*
* @return an {@link Optional} containing the navigation target class or empty if not found
*/
public Optional<Class<? extends Component>> getRoute() {
ensureComponentIsUsable();
return RouteConfiguration.forSessionScope()
.getRoute(getComponent().getHref());
}
/**
* Click the router-link for navigation.
*
* @return navigated view
*/
public Component click() {
return getRoute()
.map(navigationTarget -> UI.getCurrent().navigate(navigationTarget).orElseThrow(IllegalStateException::new))
.orElseThrow(IllegalStateException::new);
}
}
RouterLink
is missing its "RouterLinkTester
"ComponentTester
.Attempting to use
AnchorTester
in its place (analogous to usingAnchorElement
in e2e testing), such asresults in an error something like:
(Using
RouterLink.class
in place ofAnchor.class
results in a compilation error.)The text was updated successfully, but these errors were encountered: