MCPcopy Create free account
hub / github.com/angular/components / slideToValue

Function slideToValue

src/material/slider/slider.e2e.spec.ts:157–174  ·  view source on GitHub ↗

Clicks on the MatSlider at the coordinates corresponding to the given value.

(
    slider: webdriver.WebElement,
    value: number,
    thumbPosition: Thumb,
  )

Source from the content-addressed store, hash-verified

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> {

Callers 1

slider.e2e.spec.tsFile · 0.70

Calls 2

getSliderValueFunction · 0.85
getCoordsForValueFunction · 0.70

Tested by

no test coverage detected