Class RouterLinkTester

  • All Implemented Interfaces:
    com.vaadin.browserless.Clickable

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

    Tester for RouterLink components.

    Since:

    1.0

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final T component
    • Constructor Summary

      Constructors 
      Constructor Description
      RouterLinkTester(T component) Wrap given component for testing.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      String getHref() Gets the URL that the router-link links to.
      String getPath() Gets the path for the router-link.
      QueryParameters getQueryParameters() Gets the query parameters for the router-link.
      Optional<Class<out Component>> getRoute() Gets the registered route class for the router-link.
      HasElement navigate() Navigate to the router-link target.
      void click() Click the router-link for navigation.
      • Methods inherited from class com.vaadin.browserless.ComponentTester

        ensureComponentIsUsable, find, getComponent, isUsable, setModal
      • Methods inherited from class com.vaadin.browserless.Clickable

        click, click, middleClick, middleClick, rightClick, rightClick
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RouterLinkTester

        RouterLinkTester(T component)

        Wrap given component for testing.

        Parameters:
        component - target component
    • Method Detail

      • getHref

         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

         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

         QueryParameters getQueryParameters()

        Gets the query parameters for the router-link.

        Returns:

        a QueryParameters containing the navigation target's query parameters

      • getRoute

         Optional<Class<out 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

      • navigate

         HasElement navigate()

        Navigate to the router-link target.

        Returns:

        navigated view

      • click

         void click()

        Click the router-link for navigation. This is equivalent to calling navigate. For cases where you need to access the navigated view, use navigate instead as it returns the target view.