update
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2ContainerCardBs from '@/components/d2-container/components/d2-container-card-bs.vue'
|
||||
|
||||
describe('d2-container-card-bs', () => {
|
||||
// 存在且是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()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
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')
|
||||
})
|
||||
})
|
||||
@@ -1,55 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2ContainerCard from '@/components/d2-container/components/d2-container-card.vue'
|
||||
|
||||
describe('d2-container-card', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2ContainerCard)
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 包含特定类名
|
||||
it('contains specific classnames', () => {
|
||||
const wrapper = mount(D2ContainerCard, {
|
||||
slots: {
|
||||
default: '<div>body</div>',
|
||||
header: '<div>header</div>',
|
||||
footer: '<div>footer</div>'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.is('.d2-container-card')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-card__header')).toBeTruthy()
|
||||
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()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2ContainerCard, {
|
||||
propsData: {
|
||||
scrollDelay: 30
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().scrollDelay).toEqual(30)
|
||||
})
|
||||
|
||||
// 渲染slot
|
||||
it('has one or more slots', () => {
|
||||
const wrapper = mount(D2ContainerCard, {
|
||||
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')
|
||||
})
|
||||
})
|
||||
@@ -1,35 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2ContainerFrame from '@/components/d2-container-frame/index.vue'
|
||||
|
||||
describe('d2-container-frame', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2ContainerFrame, {
|
||||
stubs: ['d2-container']
|
||||
})
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 包含特定类名
|
||||
it('contains specific classnames', () => {
|
||||
const wrapper = mount(D2ContainerFrame, {
|
||||
stubs: ['d2-container']
|
||||
})
|
||||
|
||||
expect(wrapper.contains('.d2-container-frame')).toBeTruthy()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2ContainerFrame, {
|
||||
stubs: ['d2-container'],
|
||||
propsData: {
|
||||
src: 'https://fairyever.com/d2-admin/doc/zh/'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().src).toEqual('https://fairyever.com/d2-admin/doc/zh/')
|
||||
})
|
||||
})
|
||||
@@ -1,55 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2ContainerFullBs from '@/components/d2-container/components/d2-container-full-bs.vue'
|
||||
|
||||
describe('d2-container-full-bs', () => {
|
||||
// 存在且是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()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
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')
|
||||
})
|
||||
})
|
||||
@@ -1,54 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2ContainerFull from '@/components/d2-container/components/d2-container-full.vue'
|
||||
|
||||
describe('d2-container-full', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2ContainerFull)
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 包含特定类名
|
||||
it('contains specific classnames', () => {
|
||||
const wrapper = mount(D2ContainerFull, {
|
||||
slots: {
|
||||
default: '<div>body</div>',
|
||||
header: '<div>header</div>',
|
||||
footer: '<div>footer</div>'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.is('.d2-container-full')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-full__header')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-full__body')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-full__footer')).toBeTruthy()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2ContainerFull, {
|
||||
propsData: {
|
||||
scrollDelay: 30
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().scrollDelay).toEqual(30)
|
||||
})
|
||||
|
||||
// 渲染slot
|
||||
it('has one or more slots', () => {
|
||||
const wrapper = mount(D2ContainerFull, {
|
||||
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')
|
||||
})
|
||||
})
|
||||
@@ -1,65 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2ContainerGhostBs from '@/components/d2-container/components/d2-container-ghost-bs.vue'
|
||||
|
||||
describe('d2-container-ghost-bs', () => {
|
||||
// 存在且是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')
|
||||
})
|
||||
})
|
||||
@@ -1,54 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2ContainerGhost from '@/components/d2-container/components/d2-container-ghost.vue'
|
||||
|
||||
describe('d2-container-ghost', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2ContainerGhost)
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 包含特定类名
|
||||
it('contains specific classnames', () => {
|
||||
const wrapper = mount(D2ContainerGhost, {
|
||||
slots: {
|
||||
default: '<div>body</div>',
|
||||
header: '<div>header</div>',
|
||||
footer: '<div>footer</div>'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.is('.d2-container-ghost')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-ghost__header')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-ghost__body')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-container-ghost__footer')).toBeTruthy()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2ContainerGhost, {
|
||||
propsData: {
|
||||
scrollDelay: 30
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().scrollDelay).toEqual(30)
|
||||
})
|
||||
|
||||
// 渲染slot
|
||||
it('has one or more slots', () => {
|
||||
const wrapper = mount(D2ContainerGhost, {
|
||||
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')
|
||||
})
|
||||
})
|
||||
@@ -1,27 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2IconSvg from '@/components/d2-icon-svg/index.vue'
|
||||
|
||||
describe('d2-icon-svg', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2IconSvg, {
|
||||
propsData: {
|
||||
name: 'add'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2IconSvg, {
|
||||
propsData: {
|
||||
name: 'add'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().name).toEqual('add')
|
||||
})
|
||||
})
|
||||
@@ -1,31 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2Icon from '@/components/d2-icon/index.vue'
|
||||
|
||||
describe('d2-icon', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2Icon)
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 包含特定类名
|
||||
it('contains specific classnames', () => {
|
||||
const wrapper = mount(D2Icon)
|
||||
|
||||
expect(wrapper.is('.fa')).toBeTruthy()
|
||||
expect(wrapper.contains('.fa-font-awesome')).toBeTruthy()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2Icon, {
|
||||
propsData: {
|
||||
name: 'font-awesome'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().name).toEqual('font-awesome')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user