Class CheckboxTester<T extends com.vaadin.flow.component.checkbox.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>

public class CheckboxTester<T extends com.vaadin.flow.component.checkbox.Checkbox> extends ComponentTester<T>
Tester for Checkbox components.
Since:
1.0
  • Constructor Details

    • CheckboxTester

      public CheckboxTester(T component)
      Wrap given component for testing.
      Parameters:
      component - target component
  • Method Details

    • isChecked

      public boolean isChecked()
      Checks whether the checkbox is currently checked.
      Returns:
      true if the checkbox is checked, false otherwise
      Since:
      25.3
    • 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.

      Since:
      25.3
    • 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.

      Since:
      25.3
    • 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 by ComponentTester.ensureComponentIsUsable().
      Overrides:
      isUsable in class ComponentTester<T extends com.vaadin.flow.component.checkbox.Checkbox>
      Returns:
      true if component can be interacted with by the user
      See Also:
    • notUsableReasons

      protected void notUsableReasons(Consumer<String> collector)
      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 by ComponentTester.ensureComponentIsUsable().
      Overrides:
      notUsableReasons in class ComponentTester<T extends com.vaadin.flow.component.checkbox.Checkbox>
      Parameters:
      collector - receives the components the tester walks over
      See Also:
    • click

      public void click(int button, MetaKeys metaKeys)
      Description copied from interface: Clickable
      Performs 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