【发布时间】:2019-06-11 13:40:34
【问题描述】:
我在 React 测试库中使用 getByTestId 函数:
const button = wrapper.getByTestId("button");
expect(heading.textContent).toBe("something");
是否可以/建议搜索 HTML 元素?所以是这样的:
const button = wrapper.getByHTML("button");
const heading = wrapper.getByHTML("h1");
【问题讨论】: