com.vaadin.flow.component.textfield.
Class TextFieldTester<T extends TextFieldBase<T,V>,V>
Type Parameters:
T
- component type
V
- value type
Tester for TextField components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Resets the value to the empty one, as when clicking on component clear button on the browser.
boolean
isUsable()
Validate that component can be interacted with and should be visible in the UI.
protected void
notUsableReasons
(Consumer<String> collector) Provides messages explaining why the component is actually not usable.
void
Set the value to the component if it is usable.
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, notUsableReasons, roundTrip, setModal
-
Constructor Details
-
TextFieldTester
Wrap given component for testing.
Parameters:
component
- target component
-
-
Method Details
-
setValue
Set the value to the component if it is usable. For a non interactable component an IllegalStateException will be thrown as the end user would not be able to set a value.
Parameters:
value
- value to set -
clear
public void clear()Resets the value to the empty one, as when clicking on component clear button on the browser. An
IllegalStateException
is thrown if the clear button is not visible.Throws:
IllegalStateException
- if the text field is not usable or the clear button is not visible. -
isUsable
public boolean isUsable()Description copied from class:
ComponentTester
Validate that component can be interacted with and should be visible in the UI. Subclasses overriding this method should also override
ComponentTester.notUsableReasons(Consumer)
to provide additional details to the potential exception thrown byComponentTester.ensureComponentIsUsable()
.Overrides:
isUsable
in classComponentTester<T extends TextFieldBase<T,
V>> Returns:
true
if component can be interacted with by the userSee Also:
-
notUsableReasons
Description copied from class:
ComponentTester
Provides messages explaining why the component is actually not usable. Subclasses overriding
ComponentTester.isUsable()
should also override this method to provide additional details to the potential exception throw byComponentTester.ensureComponentIsUsable()
.Overrides:
notUsableReasons
in classComponentTester<T extends TextFieldBase<T,
V>> See Also:
-