Closed daniloab closed 4 years ago
I have the same problem here. I tried testing with fireEvent.valueChange
because it works with Switch
component.
Hi! same here, have you found a way to test this?
Not yet
Hi, not sure if this helps, but for React (non-native) Testing Library I can do:
fireEvent.change(screen.getByRole('slider'), { target: { value: '2' }}) // my slider has min '1' and max '7', hence value '2' makes sense
Though I guess the fireEvent API is different for React Native Testing Library.
(PS I'd love a way to test this behaviour from the user's point of view, such as fireEvent.moveSliderLeft(screen.getByRole('slider'), 2)
)
Use the Slider's API and fire appropriate event. FYI, this repository is no longer responsible for this package. See the migration guide to v7.0.
I need to test a slider component simulating the drag gesture. How can I do this on testing library?
Beside to this, I opened another issue in the repo of the slider component that I use to be setting the testID in the correct component to help me with the test. See it https://github.com/ptomasroos/react-native-multi-slider/issues/172