Class IntegerSliderTester<T extends IntegerSlider>

java.lang.Object
com.vaadin.browserless.ComponentTester<T>
com.vaadin.flow.component.slider.IntegerSliderTester<T>
Type Parameters:
T - component type
All Implemented Interfaces:
Clickable<T>

public class IntegerSliderTester<T extends IntegerSlider> extends ComponentTester<T>
Tester for IntegerSlider components.

Simulates the user moving the slider handle in the browser: setting the value directly or incrementing/decrementing it by steps, with validation that the component is usable and the value stays within the min/max bounds and step alignment.

Since:
1.1
  • Constructor Details

    • IntegerSliderTester

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

    • fromDouble

      protected Integer fromDouble(double value)
      Converts a double value to the slider's value type.
      Parameters:
      value - the double value to convert
      Returns:
      the converted value
    • setValue

      public void setValue(Integer value)
      Simulates the user dragging the slider handle to the given value.

      Throws if the component is not usable or the value is outside the min/max range.

      Parameters:
      value - value to set
      Throws:
      IllegalArgumentException - if the value is outside the min/max range
    • increment

      public void increment()
      Simulates the user pressing the Right/Up arrow key to increase the value by one step. The value is clamped to the maximum.
    • decrement

      public void decrement()
      Simulates the user pressing the Left/Down arrow key to decrease the value by one step. The value is clamped to the minimum.
    • incrementBy

      public void incrementBy(int steps)
      Simulates the user dragging the slider handle to increase the value by the given number of steps. The value is clamped to the maximum.
      Parameters:
      steps - number of steps to increment
    • decrementBy

      public void decrementBy(int steps)
      Simulates the user dragging the slider handle to decrease the value by the given number of steps. The value is clamped to the minimum.
      Parameters:
      steps - number of steps to decrement