1
我試圖讓我的頭在開玩笑。這是我的測試:如何測試組件是否包含字符串?
test('whether contains className',() => {
let list = [
{
id: 12,
name: 'two',
completed: true
}
];
const wrapper = shallow(
<Todos todos={list}>
</Todos>
);
expect(wrap).toMatch(/strikethrough/);
});
如何檢查組件中是否包含(子)字符串?
我該如何檢查html?我有一個className值,我想檢查一下嗎? –
其實,這會給html一個字符串。使用'console.log(wrapper.text())'看看你得到了什麼。 –