数据过滤、搜索与 React Router 测试驱动开发
在前端开发中,数据过滤、搜索以及页面导航是常见的需求。本文将介绍如何进行数据过滤和搜索的测试,以及如何使用 React Router 进行测试驱动开发,实现无刷新的页面导航。
数据过滤与搜索测试
在进行数据过滤和搜索功能开发时,我们需要确保代码的正确性和稳定性。下面是一段测试代码示例:
const buttonContainer = renderAdditional(
searchFor(customer)
);
click(buttonContainer.firstChild);
expect(
element("#AppointmentFormLoader")
).not.toBeNull();
expect(
propsOf(AppointmentFormLoader).original
).toMatchObject({ customer: 123 });
为了让测试通过,我们需要更新 src/App.js 中的 searchActions 函数,使其使用 CustomerSearch 传递的 customer 参数:
const searchActions = (customer) => (
<button
onClick={
超级会员免费看
订阅专栏 解锁全文
53

被折叠的 条评论
为什么被折叠?



