Skip to content

Commit

Permalink
chore(slider): fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ksem committed Mar 20, 2024
1 parent ee3de44 commit c1084e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ui/src/components/va-slider/VaSlider.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function valueToClientY (slider: HTMLElement, element: HTMLElement, newValue: nu

const coordinate = element.getBoundingClientRect()

return (element.clientHeight / (max - min)) * newValue + coordinate.y
return (Math.round(element.offsetHeight) / (max - min)) * newValue + Math.round(coordinate.y)
}

export default {
Expand Down Expand Up @@ -612,6 +612,8 @@ export const Vertical: StoryFn = () => ({
Vertical.play = async ({ step }) => {
const { slider, sliderThumb, sliderTrack } = getSliderAll()

await sleep(500) // Wait when fonts are loaded

await step('Change value by clicking on the slider track (vertical)', async () => {
const clientY = valueToClientY(slider[0], sliderTrack[0], 50)

Expand Down

0 comments on commit c1084e9

Please sign in to comment.