unit test: d2-container-full-bs
Former-commit-id: 283e7db715965f9a3bef2755bd885ea7edd8629b [formerly 283e7db715965f9a3bef2755bd885ea7edd8629b [formerly 283e7db715965f9a3bef2755bd885ea7edd8629b [formerly 283e7db715965f9a3bef2755bd885ea7edd8629b [formerly 4c20b5b7a5a86fb78bacb1ee3106032db07dd50b [formerly 63b3feba8b2ef8982c25697b53bbf4341925e290]]]]] Former-commit-id: 93ae445a627e3c17dcb2a8d5afebf19e58025fd4 Former-commit-id: 8880b3e9a48f09f6c0351b625224d4d31881fc3e Former-commit-id: 146e5ee8dbfeb2f6b0774d0b94482d3963bf2685 [formerly 5783bd169e1cc31b5ebc5e87dc2bf889cb428a80] Former-commit-id: 5bacf88c3d52084893f319c83db2f3bc1866e1bf Former-commit-id: 413ba702b7376ba92f233387f6a1146dc4f9402d Former-commit-id: f286c8987e4799a161b59209251400a2aa4037e1 Former-commit-id: bba6285faddc0a2f89e6f350fb0822271f8760ad Former-commit-id: a5e70c2b975db855bce46ad0dc1f2f25507d1981
This commit is contained in:
parent
63f557bd69
commit
ccc5c5f631
|
|
@ -0,0 +1,55 @@
|
|||
import { mount } from '@vue/test-utils'
|
||||
import D2ContainerFullBs from '@/components/d2-container/components/d2-container-full-bs.vue'
|
||||
|
||||
describe('d2-container-full-bs.vue', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2ContainerFullBs)
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 包含特定类名
|
||||
it('contains specific classnames', () => {
|
||||
const wrapper = mount(D2ContainerFullBs, {
|
||||
slots: {
|
||||
default: '<div>body</div>',
|
||||
header: '<div>header</div>',
|
||||
footer: '<div>footer</div>'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.is('.d2-container-full-bs')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-full-bs__header')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-full-bs__body')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-full-bs__body-wrapper-inner')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-full-bs__footer')).toBeTruthy()
|
||||
})
|
||||
|
||||
// betterScrollOptions prop
|
||||
it('has a property named \'betterScrollOptions\'', () => {
|
||||
const wrapper = mount(D2ContainerFullBs, {
|
||||
propsData: {
|
||||
betterScrollOptions: {}
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().betterScrollOptions).toEqual({})
|
||||
})
|
||||
|
||||
// 渲染slot
|
||||
it('has one or more slots', () => {
|
||||
const wrapper = mount(D2ContainerFullBs, {
|
||||
slots: {
|
||||
default: '<div>body</div>',
|
||||
header: '<div>header</div>',
|
||||
footer: '<div>footer</div>'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.text()).toMatch('header')
|
||||
expect(wrapper.text()).toMatch('body')
|
||||
expect(wrapper.text()).toMatch('footer')
|
||||
})
|
||||
})
|
||||
Loading…
Reference in New Issue