Class AnchorTester
java.lang.Object
com.vaadin.testbench.unit.ComponentTester<Anchor>
com.vaadin.flow.component.html.testbench.HtmlComponentTester<Anchor>
com.vaadin.flow.component.html.testbench.HtmlContainerTester<Anchor>
com.vaadin.flow.component.html.testbench.AnchorTester
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclick()Click the anchor for navigation if target is a registered route in the application.voiddownload(OutputStream outputStream) Download the stream resource linked by the anchor.getHref()Gets the URL that the anchor links to.getPath()Gets the path for the router-link.Gets the query parameters for the router-link.navigate()Navigate to the anchor target if it's a registered route in the application.Methods inherited from class com.vaadin.flow.component.html.testbench.HtmlContainerTester
getTextMethods inherited from class com.vaadin.flow.component.html.testbench.HtmlComponentTester
getTitleMethods 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
-
AnchorTester
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Details
-
getHref
Gets the URL that the anchor links to.- Returns:
- the href value, or
""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
-
click
public void click()Click the anchor for navigation if target is a registered route in the application. This is equivalent to callingnavigate(). For cases where you need to access the navigated view, usenavigate()instead as it returns the target view.- Throws:
IllegalStateException- if anchor href is not a String or not a route
-
download
Download the stream resource linked by the anchor.- Parameters:
outputStream- output stream to write the stream resource to- Throws:
IllegalStateException- if the anchor does not link to a stream resource
-