describe('omni-button.vue', () => {
it('create', () => {
const wrapper = mount(() => type="paimary" />)
expect(wrapper.classes()).toContain('el-button-paimary')
})
})
组件OmniButton 本质上就是elementPlus的button组件,只不过是被OmniButton给再次封装了一层。
代码块里第三行内容贴错了,正确情况如下:
describe('omni-button.vue', () => {
it('create', () => {
const wrapper = mount(() => <OmniButton type="paimary" />)
expect(wrapper.classes()).toContain('el-button-paimary')
})
})
"paimary" => "primary"
你这个实际上是node的问题,不是vue的问题,node需要加css模块才能用css,可以参考下下文:
primary改成这个,