react-input-range icon indicating copy to clipboard operation
react-input-range copied to clipboard

Testing - How to simulate value change

Open katfa opened this issue 9 years ago • 4 comments

I'm trying to write a test which checks that when I change the values, certain strings in the DOM change.

I'm trying to simulate a click on the track container or the slider, but it does not seem to register the click event. Or a mousedown event. Is this possible?

katfa avatar Oct 28 '16 20:10 katfa

I'm in the same situation. Any ideas on this?

cavaloni avatar Feb 02 '18 00:02 cavaloni

Any luck with this at all? I'm finding a way to programmatically animate a slider

IfyNdu avatar Mar 20 '18 09:03 IfyNdu

It has some special way of testing, apparently https://github.com/davidchin/react-input-range/blob/master/test/input-range/input-range.spec.jsx

shierro avatar Aug 17 '18 13:08 shierro

I've tested this by triggering the onChange event manually on a mounted component, not via the UI 😢

In case this helps anyone...

...
wrapper
      .find('InputRange')
      .instance()
      .props.onChange(YOUR_NEW_VALUE);
await wrapper.update();
expect(...);

Where YOUR_NEW_VALUE would be 1 for example.

jamiemagique avatar Jan 02 '19 19:01 jamiemagique