com.vaadin.flow.component.routerlink.

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

public class RouterLinkTester<T extends RouterLink> extends ComponentTester<T>

Tester for RouterLink components.

  • Constructor Details

    • RouterLinkTester

      public RouterLinkTester(T component)

      Wrap given component for testing.

      Parameters:

      component - target component

  • Method Details

    • getHref

      public String getHref()

      Gets the URL that the router-link links to.

      Returns:

      the href value, or empty string if no href has been set

    • getPath

      public String getPath()

      Gets the path for the router-link. Returns an empty String if there is no corresponding navigation target.

      Returns:

      a String containing the navigation target path or empty if not present

    • getQueryParameters

      public QueryParameters getQueryParameters()

      Gets the query parameters for the router-link.

      Returns:

      a QueryParameters containing the navigation target's query parameters

    • getRoute

      public Optional<Class<? extends Component>> getRoute()

      Gets the registered route class for the router-link. Returns an empty optional if there is no corresponding navigation target.

      Returns:

      an Optional containing the navigation target class or empty if not found

    • click

      public HasElement click()

      Click the router-link for navigation.

      Returns:

      navigated view