Class CheckboxTester<T extends Checkbox>
java.lang.Object
com.vaadin.browserless.ComponentTester<T>
com.vaadin.flow.component.checkbox.CheckboxTester<T>
- Type Parameters:
T- component type
- All Implemented Interfaces:
Clickable<T>
Tester for Checkbox components.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheck()Checks the checkbox by clicking it, as a user would.voidPerforms a click with the specified button and meta keys.booleanChecks whether the checkbox is currently checked.booleanisUsable()Validate that component can be interacted with and should be visible in the UI.protected voidnotUsableReasons(Consumer<String> collector) Provides messages explaining why the component is actually not usable.voiduncheck()Unchecks the checkbox by clicking it, as a user would.Methods inherited from class com.vaadin.browserless.ComponentTester
canSetValueAsUser, clearAsUser, clickClearButtonAsUser, ensureComponentIsUsable, ensureComponentIsUsable, ensureComponentIsUsableOrDetach, ensureVisible, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, isComponentReadOnly, isUsable, notUsableReasons, roundTrip, setModal, setPropertyAsUser, setValueAsUser, setValueAsUserMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.browserless.Clickable
click, click, middleClick, middleClick, rightClick, rightClick
-
Constructor Details
-
CheckboxTester
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Details
-
isChecked
public boolean isChecked()Checks whether the checkbox is currently checked.- Returns:
trueif the checkbox is checked,falseotherwise
-
check
public void check()Checks the checkbox by clicking it, as a user would.Does nothing if the checkbox is already checked, since a user would not click it in that case. The checkbox must be usable either way.
-
uncheck
public void uncheck()Unchecks the checkbox by clicking it, as a user would.Does nothing if the checkbox is already unchecked, since a user would not click it in that case. The checkbox must be usable either way.
-
isUsable
public boolean isUsable()Description copied from class:ComponentTesterValidate that component can be interacted with and should be visible in the UI. Subclasses overriding this method should also overrideComponentTester.notUsableReasons(Consumer)to provide additional details to the potential exception thrown byComponentTester.ensureComponentIsUsable().- Overrides:
isUsablein classComponentTester<T extends Checkbox>- Returns:
trueif component can be interacted with by the user- See Also:
-
notUsableReasons
Description copied from class:ComponentTesterProvides messages explaining why the component is actually not usable. Subclasses overridingComponentTester.isUsable()should also override this method to provide additional details to the potential exception throw byComponentTester.ensureComponentIsUsable().- Overrides:
notUsableReasonsin classComponentTester<T extends Checkbox>- See Also:
-
click
Description copied from interface:ClickablePerforms a click with the specified button and meta keys.- Parameters:
button- the mouse button (0=left, 1=middle, 2=right)metaKeys- the meta keys pressed during click
-