Former-commit-id: 0043b5f5d5d3929d432e04a1c29f38ad039ad57c [formerly 0043b5f5d5d3929d432e04a1c29f38ad039ad57c [formerly 0043b5f5d5d3929d432e04a1c29f38ad039ad57c [formerly 0043b5f5d5d3929d432e04a1c29f38ad039ad57c [formerly 62c1c67cf4204ce64685812f1ce66ee7607c08d4 [formerly 9dd74154fcc5f0616ae15f9953c523fc0778a430]]]]] Former-commit-id: 8705942098de72b8d037068623b0cd85134f9aa6 Former-commit-id: a3c6c9fa65dee6fcb4b020bd31d48d51d581c42f Former-commit-id: 356b33963109fe654be6f07aceaaf8ba600fc429 [formerly 245b9a094d3ac4631ccece0b8161bd8ef88337d8] Former-commit-id: 009ad7730d68e708e3354ea32e809b704a36b538 Former-commit-id: d6d00e641c4d14af7a27d61648b44f54a412ce9d Former-commit-id: 148440c65e18ee7d577f8b4fded3eb6b6a4a0211 Former-commit-id: e79c7dd2c985c10ab3c5f2ecb5c24b3e28f71737 Former-commit-id: 0eeb1b06586af98c04877a7ce4e8cad98e3fc9ff
65 lines
1.8 KiB
JavaScript
65 lines
1.8 KiB
JavaScript
import { mount } from '@vue/test-utils'
|
|
import D2ContainerGhostBs from '@/components/d2-container/components/d2-container-ghost-bs.vue'
|
|
|
|
describe('d2-container-ghost-bs.vue', () => {
|
|
// 存在且是Vue组件实例
|
|
it('is a vue instance', () => {
|
|
const wrapper = mount(D2ContainerGhostBs, {
|
|
slots: {
|
|
default: '<div>body</div>',
|
|
header: '<div>header</div>',
|
|
footer: '<div>footer</div>'
|
|
}
|
|
})
|
|
|
|
expect(wrapper.exists()).toBeTruthy()
|
|
expect(wrapper.isVueInstance()).toBeTruthy()
|
|
})
|
|
|
|
// 包含特定类名
|
|
it('contains specific classnames', () => {
|
|
const wrapper = mount(D2ContainerGhostBs, {
|
|
slots: {
|
|
default: '<div>body</div>',
|
|
header: '<div>header</div>',
|
|
footer: '<div>footer</div>'
|
|
}
|
|
})
|
|
|
|
expect(wrapper.is('.d2-container-ghost-bs')).toBeTruthy()
|
|
expect(wrapper.contains('.d2-container-ghost-bs__header')).toBeTruthy()
|
|
expect(wrapper.contains('.d2-container-ghost-bs__body')).toBeTruthy()
|
|
expect(wrapper.contains('.d2-container-ghost-bs__footer')).toBeTruthy()
|
|
})
|
|
|
|
// props
|
|
it('has props', () => {
|
|
const wrapper = mount(D2ContainerGhostBs, {
|
|
slots: {
|
|
default: '<div>body</div>',
|
|
header: '<div>header</div>',
|
|
footer: '<div>footer</div>'
|
|
},
|
|
propsData: {
|
|
betterScrollOptions: {}
|
|
}
|
|
})
|
|
|
|
expect(wrapper.props().betterScrollOptions).toEqual({})
|
|
})
|
|
|
|
// 渲染slot
|
|
it('has one or more slots', () => {
|
|
const wrapper = mount(D2ContainerGhostBs, {
|
|
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')
|
|
})
|
|
}) |