d2-container-card-bs
Former-commit-id: c009373c074fb773647835bb5bb45d708f5eb457 [formerly c009373c074fb773647835bb5bb45d708f5eb457 [formerly c009373c074fb773647835bb5bb45d708f5eb457 [formerly c009373c074fb773647835bb5bb45d708f5eb457 [formerly ee20123fa36557a79909cf3cfca22f8ba21a2000 [formerly 0e4ed247546b3443b397afac63226eed1cebe5ec]]]]] Former-commit-id: 61abb29ff438bc31f4352343854b50a5100866c7 Former-commit-id: d2546ca72f81e1889257484db2f1af22d456f676 Former-commit-id: c90c0fadc2c1827b992e56c427cefd18d26b09e7 [formerly 6bd4f6596ca8c62f7f38beb21cd7376617414b85] Former-commit-id: 0d1493f9b87238c5c2650735064707e51656d8c4 Former-commit-id: 0ff4acd130f38bcc7d35f3cdfb682c4498ab74ba Former-commit-id: b17c30151bd7aada600e54915628d1002d170445 Former-commit-id: 657f8fa764e965419f3c772fc75e4e6c59fba9e3 Former-commit-id: d2ecbcf192d4a142a111aec3f477ede79c2e021a
This commit is contained in:
parent
55c2fc3dc2
commit
a1d5dcf4e3
|
|
@ -0,0 +1,55 @@
|
|||
import { mount } from '@vue/test-utils'
|
||||
import D2ContainerCardBs from '@/components/d2-container/components/d2-container-card-bs.vue'
|
||||
|
||||
describe('d2-container-card-bs.vue', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2ContainerCardBs)
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 包含特定类名
|
||||
it('contains specific classnames', () => {
|
||||
const wrapper = mount(D2ContainerCardBs, {
|
||||
slots: {
|
||||
default: '<div>body</div>',
|
||||
header: '<div>header</div>',
|
||||
footer: '<div>footer</div>'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.is('.d2-container-card-bs')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-card-bs__header')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-card-bs__body')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-card-bs__body-card')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-card-bs__footer')).toBeTruthy()
|
||||
})
|
||||
|
||||
// betterScrollOptions prop
|
||||
it('has a property named \'betterScrollOptions\'', () => {
|
||||
const wrapper = mount(D2ContainerCardBs, {
|
||||
propsData: {
|
||||
betterScrollOptions: {}
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().betterScrollOptions).toEqual({})
|
||||
})
|
||||
|
||||
// 渲染slot
|
||||
it('has one or more slots', () => {
|
||||
const wrapper = mount(D2ContainerCardBs, {
|
||||
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')
|
||||
})
|
||||
})
|
||||
|
|
@ -25,7 +25,18 @@ describe('d2-container-card.vue', () => {
|
|||
expect(wrapper.contains('.d2-container-card__body')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-card__body-card')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-card__footer')).toBeTruthy()
|
||||
});
|
||||
})
|
||||
|
||||
// 节流间隔prop
|
||||
it('has a property named \'scrollDelay\'', () => {
|
||||
const wrapper = mount(D2ContainerCard, {
|
||||
propsData: {
|
||||
scrollDelay: 30
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().scrollDelay).toEqual(30)
|
||||
})
|
||||
|
||||
// 渲染slot
|
||||
it('has one or more slots', () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue