Clicks on the MatSlider at the coordinates corresponding to the given value.
( slider: MatSlider, input: MatSliderThumb, value: number, isRtl: boolean = false, )
| 2120 | |
| 2121 | /** Clicks on the MatSlider at the coordinates corresponding to the given value. */ |
| 2122 | async function setValueByClick( |
| 2123 | slider: MatSlider, |
| 2124 | input: MatSliderThumb, |
| 2125 | value: number, |
| 2126 | isRtl: boolean = false, |
| 2127 | ) { |
| 2128 | const inputElement = input._elementRef.nativeElement; |
| 2129 | const val = isRtl ? slider.max - value : value; |
| 2130 | const {x, y} = getCoordsForValue(slider, value); |
| 2131 | |
| 2132 | dispatchPointerEvent(inputElement, 'pointerdown', x, y); |
| 2133 | input.value = val; |
| 2134 | dispatchEvent(input._hostElement, new Event('input')); |
| 2135 | input.focus(); |
| 2136 | dispatchPointerEvent(inputElement, 'pointerup', x, y); |
| 2137 | dispatchEvent(input._hostElement, new Event('change')); |
| 2138 | await new Promise(r => setTimeout(r, 0)); |
| 2139 | } |
| 2140 | |
| 2141 | /** Slides the MatSlider's thumb to the given value. */ |
| 2142 | async function slideToValue(slider: MatSlider, input: MatSliderThumb, value: number) { |
no test coverage detected