unit test: d2-count-up d2-icon
Former-commit-id: 7fad78a4b7f62ebe674342e8154f4497b79c5b06 [formerly 7fad78a4b7f62ebe674342e8154f4497b79c5b06 [formerly 7fad78a4b7f62ebe674342e8154f4497b79c5b06 [formerly 7fad78a4b7f62ebe674342e8154f4497b79c5b06 [formerly e6036f61ab8105232d3e57f6c84182c092a74fd1 [formerly 17cf5e498be64a1c9b05456ff022241537957376]]]]] Former-commit-id: c7f917c0128ec8867cd96710c7bcceba63c62dfd Former-commit-id: 9dff6eabb4254aa4e4807a58c961532dc5d8b47e Former-commit-id: 68bd970afdebd5c56bd0e72ffe871d687eccee69 [formerly 534cc268a850f9743ea398eae910dd1419b3b497] Former-commit-id: eace96ad1ee3407d93f3a87385fc13d6ee1936c3 Former-commit-id: c448d93d9f03dee110afba702f83e77cb36002dc Former-commit-id: bfefc7d1f57c67106a4da79e77682e33804630ed Former-commit-id: 65193bd67cb7775646fead1ecc77250cd5427d50 Former-commit-id: 20df260fbe97beba5badc5e31af3131ad510a7b2
This commit is contained in:
16
tests/unit/d2-count-up.spec.js
Normal file
16
tests/unit/d2-count-up.spec.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2CountUp from '@/components/d2-count-up/index.vue'
|
||||
|
||||
describe('d2-count-up.vue', () => {
|
||||
// 存在且是Vue组件实例
|
||||
it('is a vue instance', () => {
|
||||
const wrapper = mount(D2CountUp, {
|
||||
propsData: {
|
||||
end: 100
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.exists()).toBeTruthy()
|
||||
expect(wrapper.isVueInstance()).toBeTruthy()
|
||||
})
|
||||
})
|
||||
31
tests/unit/d2-icon.spec.js
Normal file
31
tests/unit/d2-icon.spec.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import D2Icon from '@/components/d2-icon/index.vue'
|
||||
|
||||
describe('d2-icon.vue', () => {
|
||||
// 存在且是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()
|
||||
})
|
||||
|
||||
// name prop
|
||||
it('has a property named \'name\'', () => {
|
||||
const wrapper = mount(D2Icon, {
|
||||
propsData: {
|
||||
name: 'font-awesome'
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.props().name).toEqual('font-awesome')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user