Clicks on the MatSlider at the coordinates corresponding to the given value.
(
slider: webdriver.WebElement,
value: number,
thumbPosition: Thumb,
)
| 155 | |
| 156 | /** Clicks on the MatSlider at the coordinates corresponding to the given value. */ |
| 157 | async function slideToValue( |
| 158 | slider: webdriver.WebElement, |
| 159 | value: number, |
| 160 | thumbPosition: Thumb, |
| 161 | ): Promise<void> { |
| 162 | const startCoords = await getCoordsForValue( |
| 163 | slider, |
| 164 | await getSliderValue(slider, thumbPosition), |
| 165 | ); |
| 166 | const endCoords = await getCoordsForValue(slider, value); |
| 167 | return await wd |
| 168 | .actions() |
| 169 | .mouseMove(slider, startCoords) |
| 170 | .mouseDown() |
| 171 | .mouseMove(slider, endCoords) |
| 172 | .mouseUp() |
| 173 | .perform(); |
| 174 | } |
| 175 | |
| 176 | /** Returns the x and y coordinates for the given slider value. */ |
| 177 | async function getCoordsForValue(slider: webdriver.WebElement, value: number): Promise<Point> { |
no test coverage detected