给定以下生成的html
<a href="#" class="primaryInversed v-btn v-btn--large v-btn--round"
<div class="v-btn__content">STOP!
<i aria-hidden="true" class="v-icon v-icon--right material-icons">pause_circle_outline</i>
</div>
</a>
当我使用 .toEqual Jest 匹配器进行测试时
console.log(playLink.text())
expect(playLink.text()).toEqual("STOP!");
由于图标,测试失败
console.log tests/unit/Heading.spec.js:46
STOP!
pause_circle_outline
如果我使用 .toMatch 观察者,它不会失败
expect(playLink.text()).toMatch(/STOP!/);
是要编写的正常测试还是要使用 .toEqual 观察者?
注意:我使用了“mount”而不是“shallowMount”,因为我需要从 vuetify 组件生成 html
感谢您的反馈