unit test: d2-source
Former-commit-id: 262746d1065b9d7732492498cbaa976506d6e0bb [formerly 262746d1065b9d7732492498cbaa976506d6e0bb [formerly 262746d1065b9d7732492498cbaa976506d6e0bb [formerly 262746d1065b9d7732492498cbaa976506d6e0bb [formerly c5f1b718ada6351ba635fe3c86a30b41306e27cd [formerly 1bca35e5870d04510f1bf61312f2aa15f2415dce]]]]] Former-commit-id: 555297611afc03ee0c6735c391194254ccd14b08 Former-commit-id: 451d89d5a4805638f948b12b6ab3c5024c5cb6e2 Former-commit-id: 062d757d5cf53079bf2c83779e418d82b02ac9ed [formerly 1eabb82bb10944e675b4aedd8349ce4d63fc1438] Former-commit-id: eb7d104d3b16e1ac982c8fc5aee89c3349838579 Former-commit-id: 3bada4298c976a4de8259fbcda5eb37a40aa2ce9 Former-commit-id: 50f36cd0121628bb1a3be4840950db18894cd06c Former-commit-id: 1f4a3f28093592fc74ae971ffb5b3d5c7657ae53 Former-commit-id: dfc27342fc8c7e9a46a11160cc37ccb3d345f75f
This commit is contained in:
parent
0caf2fde79
commit
100f8a51b0
|
|
@ -0,0 +1,39 @@
|
||||||
|
import { mount, createLocalVue } from '@vue/test-utils'
|
||||||
|
import D2Source from '@/components/d2-container/components/d2-source.vue'
|
||||||
|
import util from '@/libs/util'
|
||||||
|
|
||||||
|
describe('d2-source.vue', () => {
|
||||||
|
// 存在且是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', () => {
|
||||||
|
const wrapper = mount(D2Source, {
|
||||||
|
stubs: ['d2-icon']
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(wrapper.is('.d2-source')).toBeTruthy()
|
||||||
|
setTimeout(() => {
|
||||||
|
expect(wrapper.contains('.d2-source--active')).toBeTruthy()
|
||||||
|
}, 500)
|
||||||
|
})
|
||||||
|
|
||||||
|
// filename prop
|
||||||
|
it('has a property named \'filename\'', () => {
|
||||||
|
const wrapper = mount(D2Source, {
|
||||||
|
stubs: ['d2-icon'],
|
||||||
|
propsData: {
|
||||||
|
filename: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(wrapper.props().filename).toEqual('')
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
Reference in New Issue