Clicks on the MatSlider at the coordinates corresponding to the given value.
( slider: MatSlider, input: MatSliderThumb, value: number, isRtl: boolean = false, )
| 2086 | |
| 2087 | /** Clicks on the MatSlider at the coordinates corresponding to the given value. */ |
| 2088 | async function setValueByClick( |
| 2089 | slider: MatSlider, |
| 2090 | input: MatSliderThumb, |
| 2091 | value: number, |
| 2092 | isRtl: boolean = false, |
| 2093 | ) { |
| 2094 | const inputElement = input._elementRef.nativeElement; |
| 2095 | const val = isRtl ? slider.max - value : value; |
| 2096 | const {x, y} = getCoordsForValue(slider, value); |
| 2097 | |
| 2098 | dispatchPointerEvent(inputElement, 'pointerdown', x, y); |
| 2099 | input.value = val; |
| 2100 | dispatchEvent(input._hostElement, new Event('input')); |
| 2101 | input.focus(); |
| 2102 | dispatchPointerEvent(inputElement, 'pointerup', x, y); |
| 2103 | dispatchEvent(input._hostElement, new Event('change')); |
| 2104 | await new Promise(r => setTimeout(r, 0)); |
| 2105 | } |
| 2106 | |
| 2107 | /** Slides the MatSlider's thumb to the given value. */ |
| 2108 | async function slideToValue(slider: MatSlider, input: MatSliderThumb, value: number) { |
no test coverage detected