jestjs - 开玩笑测试条件渲染
问题描述
我有一个包含多个子组件的组件 </ page body> ,其中一个组件道具是有条件的。当我运行测试运行时,它要求我在该行上进行测试。
**const secondCardContent = props1 && (props2 === 'something1' || props3 === 'something2') && props4 === 'something3' && (**
<div className="product">
<Image className="product__image" src={item.picture} alt="product__image" />
<p className="product__name">{item.title}</p>
</div>
);
const Body = (
<PageBody
secondCardContent={secondCardContent}
/>
<Page>
<PageLayout
body={Body}
/>
</Page>
);
解决方案
推荐阅读
- session - 带有 CDI 的 JSF 2.3 中的会话固定和会话范围 Bean
- python - 自定义损失函数中没有梯度
- javascript - 自动谷歌登录 WebView React Native
- python - 在 Python 中的 DocuSign 中获取令牌
- ios - 旧 Apple 硬件上的 Cordova 和 Xcode 兼容性
- hybris - 如果数据模型不需要更新,如何减少 Hybris 构建时间?
- sql-server - SQL Server 克隆存储过程,包括授权
- mongodb - 使用优先查询条件查询 Mongoose
- python - Python Flask MySQL 提交将插入,不会更新
- git - 为什么 Bitbucket diff 显示提交列表之外的差异?