unit test: d2-icon-svg d2-link-btn

Former-commit-id: dac4516bf2f7c18c06310115e800c891f6f2ad6e [formerly dac4516bf2f7c18c06310115e800c891f6f2ad6e [formerly dac4516bf2f7c18c06310115e800c891f6f2ad6e [formerly dac4516bf2f7c18c06310115e800c891f6f2ad6e [formerly 69f4a652a91a6406e85af9f56d75e0deff6049bf [formerly e8da4ed40da1a6a5f57938914fc114cbae50ef56]]]]]
Former-commit-id: c84524e9212d0b3b11a01d0baa529af73bb2874f
Former-commit-id: 64e446eac758226d57ce5b02700596f8b1be9c3e
Former-commit-id: 9568c8329ed51f5c1367f61fc3ae59c8a2bcc67b [formerly 7d97100ddbd1c3bfbb88d560f83cec595d313b87]
Former-commit-id: 4ef6a34396e0a80837a462b6bc199eb49e66db2e
Former-commit-id: 8913eff75dff0dbf1c035733a5411cb79b07dffa
Former-commit-id: eef91026b0942b2267315cf1a8eb73c8b5622525
Former-commit-id: 12280ec0c000ccc4d39c7e99dacec12ddce920d0
Former-commit-id: d8031829cdf409c4524ce107480937ea8ba71bac
This commit is contained in:
孙昊翔 2019-01-05 10:16:55 +08:00
parent e73d7be4c5
commit 6fa8327556
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import { mount } from '@vue/test-utils'
import D2IconSvg from '@/components/d2-icon-svg/index.vue'
describe('d2-icon-svg.vue', () => {
// 存在且是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')
})
})

View File

@ -0,0 +1,30 @@
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')
})
})