如何测试反应流畅的交互作用? (以跟踪移动中的更改)(以及其他提供实例方法的库)

我使用的解决方案是将ref传递给滑块,将间谍传递给afterChange方法,但没有调用它。

it('should update local value on top slider move',() => {

// I use 2 sliders
const [top,main]: Array<RefObject<SliderMethods>> = [
  React.createRef(),React.createRef(),];
const indexes = { main: 0,top: 1 };

const afterChange = type => {
  return index => {
    indexes[type] = index;
  };
};

const {
  container,} = render(<Component sliderRefs={[top,main]} afterChange={afterChange} />);

top.current!.slickNext();
console.log(indexes); // it did not change
});
liufei0225 回答:如何测试反应流畅的交互作用? (以跟踪移动中的更改)(以及其他提供实例方法的库)

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3166212.html

大家都在问