Class DecimalSliderTester<T extends DecimalSlider>

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

public class DecimalSliderTester<T extends DecimalSlider> extends ComponentTester<T>
Tester for DecimalSlider 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.

Before Vaadin 25.2 this class was named SliderTester. It was renamed without a deprecation cycle because the Slider component is experimental and behind a feature flag.

Since:
1.1
  • Constructor Details

    • DecimalSliderTester

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

    • fromDouble

      protected Double 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(Double 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