【问题标题】:Use react's testutils with jquery elements将 react 的 testutils 与 jquery 元素一起使用
【发布时间】:2018-01-29 11:49:54
【问题描述】:

我正在尝试测试反应页面。使用.trigger("input", {which: 65}) 似乎不会调用 SyntheticEvent。所以我想知道是否有可能以某种方式将 jQuery 和 testUtils 的.simulate 结合起来?

基本上,我正在尝试做类似的事情

$('selector').simulate('input', ...)

【问题讨论】:

    标签: jquery reactjs simulate reactjs-testutils


    【解决方案1】:

    恐怕你不能。使用 TestUtils 您可以使用虚拟 dom 进行操作 - 因此您不能使用 jquery。

    您可以查看此tutorial 以了解有关测试 React 应用程序选项的更多信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-09
      • 1970-01-01
      • 1970-01-01
      • 2015-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多