Remove files
Former-commit-id: bd5123cce32c222534f0d4a7f6846ed75d9f442b
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2CountUp from '@/components/d2-count-up/index.vue'
|
||||
|
||||
describe('d2-count-up', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2CountUp, {
|
||||
propsData: {
|
||||
end: 100
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2CountUp, {
|
||||
propsData: {
|
||||
start: 0,
|
||||
end: 100,
|
||||
decimals: 0,
|
||||
duration: 2,
|
||||
options: {}
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().start).toEqual(0)
|
||||
expect(wrapper.props().end).toEqual(100)
|
||||
expect(wrapper.props().decimals).toEqual(0)
|
||||
expect(wrapper.props().duration).toEqual(2)
|
||||
expect(wrapper.props().options).toEqual({})
|
||||
})
|
||||
|
||||
// 开始数字,1秒后结束数字
|
||||
it('start number is 1, 1s later, end number is 99', (done) => {
|
||||
const wrapper = mount(D2CountUp, {
|
||||
propsData: {
|
||||
start: 1,
|
||||
end: 99,
|
||||
duration: 1
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.text()).toBe('1')
|
||||
|
||||
setTimeout(() => {
|
||||
expect(wrapper.text()).toBe('99')
|
||||
done()
|
||||
}, 1100)
|
||||
})
|
||||
|
||||
// 小数位数
|
||||
it('start number is 1.00, 1s later, end number is 99.00', (done) => {
|
||||
const wrapper = mount(D2CountUp, {
|
||||
propsData: {
|
||||
start: 1,
|
||||
end: 99,
|
||||
decimals: 2,
|
||||
duration: 1
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.text()).toBe('1.00')
|
||||
|
||||
setTimeout(() => {
|
||||
expect(wrapper.text()).toBe('99.00')
|
||||
done()
|
||||
}, 1100)
|
||||
})
|
||||
})
|
||||
@@ -1,39 +0,0 @@
|
||||
import { mount, createLocalVue } from '@vue/test-utils'
|
||||
import D2IconSelect from '@/components/d2-icon-select/index.vue'
|
||||
import ElementUI from 'element-ui'
|
||||
|
||||
describe('d2-icon-select', () => {
|
||||
const localVue = createLocalVue()
|
||||
localVue.use(ElementUI)
|
||||
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2IconSelect, {
|
||||
stubs: ['el-popover', 'el-button', 'el-input', 'el-collapse', 'el-collapse-item', 'el-col', 'el-row']
|
||||
})
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// // props
|
||||
// it('has props', () => {
|
||||
// const wrapper = mount(D2IconSelect, {
|
||||
// propsData: {
|
||||
// value: 'value',
|
||||
// placeholder: '请选择',
|
||||
// placement: 'right',
|
||||
// clearable: true,
|
||||
// userInput: false,
|
||||
// autoClose: false
|
||||
// }
|
||||
// })
|
||||
|
||||
// expect(wrapper.props().value).toEqual('value')
|
||||
// expect(wrapper.props().placeholder).toEqual('请选择')
|
||||
// expect(wrapper.props().placement).toEqual('right')
|
||||
// expect(wrapper.props().clearable).toEqual(true)
|
||||
// expect(wrapper.props().userInput).toEqual(false)
|
||||
// expect(wrapper.props().autoClose).toEqual(false)
|
||||
// })
|
||||
})
|
||||
@@ -1,30 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2LinkBtn from '@/components/d2-link-btn/index.vue'
|
||||
|
||||
describe('d2-link-btn', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2LinkBtn, {
|
||||
stubs: ['el-button-group', 'el-button', 'd2-icon']
|
||||
})
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2LinkBtn, {
|
||||
stubs: ['el-button-group', 'el-button', 'd2-icon'],
|
||||
propsData: {
|
||||
title: 'title',
|
||||
icon: 'icon',
|
||||
link: 'link'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().title).toEqual('title')
|
||||
expect(wrapper.props().icon).toEqual('icon')
|
||||
expect(wrapper.props().link).toEqual('link')
|
||||
})
|
||||
})
|
||||
@@ -1,30 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2ModuleIndexBanner from '@/components/d2-module-index-banner/index.vue'
|
||||
|
||||
describe('d2-module-index-banner', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2ModuleIndexBanner, {
|
||||
stubs: ['d2-icon']
|
||||
})
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2ModuleIndexBanner, {
|
||||
stubs: ['d2-icon'],
|
||||
propsData: {
|
||||
title: 'title',
|
||||
subTitle: 'subTitle',
|
||||
link: 'link'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().title).toEqual('title')
|
||||
expect(wrapper.props().subTitle).toEqual('subTitle')
|
||||
expect(wrapper.props().link).toEqual('link')
|
||||
})
|
||||
})
|
||||
@@ -1,36 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2ModuleIndexMenu from '@/components/d2-module-index-menu/index.vue'
|
||||
import menu from '@/menu/modules/demo-business'
|
||||
|
||||
describe('d2-module-index-menu', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2ModuleIndexMenu, {
|
||||
stubs: ['el-button'],
|
||||
propsData: {
|
||||
menu
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 300m后正确渲染,包含特定类名
|
||||
it('contains specific classnames', (done) => {
|
||||
const wrapper = mount(D2ModuleIndexMenu, {
|
||||
stubs: ['el-button'],
|
||||
propsData: {
|
||||
menu: menu
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
expect(wrapper.is('.d2-module-index-menu')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-module-index-menu-group')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-module-index-menu-group--title')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-module-index-menu-item')).toBeTruthy()
|
||||
done()
|
||||
}, 400)
|
||||
})
|
||||
})
|
||||
@@ -1,41 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2PageCover from '@/components/d2-page-cover/index.vue'
|
||||
|
||||
describe('d2-page-cover', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2PageCover)
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 包含特定类名
|
||||
it('contains specific classnames', () => {
|
||||
const wrapper = mount(D2PageCover, {
|
||||
slots: {
|
||||
default: '<div>default</div>',
|
||||
footer: '<div>footer</div>'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.is('.d2-page-cover')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-page-cover__logo')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-page-cover__title')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-page-cover__sub-title')).toBeTruthy()
|
||||
expect(wrapper.contains('.d2-page-cover__build-time')).toBeTruthy()
|
||||
})
|
||||
|
||||
// 渲染slot
|
||||
it('has one or more slots', () => {
|
||||
const wrapper = mount(D2PageCover, {
|
||||
slots: {
|
||||
default: '<div>default</div>',
|
||||
footer: '<div>footer</div>'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.text()).toMatch('default')
|
||||
expect(wrapper.text()).toMatch('footer')
|
||||
})
|
||||
})
|
||||
@@ -1,39 +0,0 @@
|
||||
import { mount, createLocalVue } from '@vue/test-utils'
|
||||
import D2Source from '@/components/d2-container/components/d2-source.vue'
|
||||
|
||||
describe('d2-source', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2Source, {
|
||||
stubs: ['d2-icon']
|
||||
})
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
|
||||
// 包含特定类名
|
||||
it('contains specific classnames', (done) => {
|
||||
const wrapper = mount(D2Source, {
|
||||
stubs: ['d2-icon']
|
||||
})
|
||||
|
||||
expect(wrapper.is('.d2-source')).toBeTruthy()
|
||||
setTimeout(() => {
|
||||
expect(wrapper.contains('.d2-source--active')).toBeTruthy()
|
||||
done()
|
||||
}, 600)
|
||||
})
|
||||
|
||||
// props
|
||||
it('has props', () => {
|
||||
const wrapper = mount(D2Source, {
|
||||
stubs: ['d2-icon'],
|
||||
propsData: {
|
||||
filename: ''
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().filename).toEqual('')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user