1 Star 0 Fork 74

mantouo10/jeecp

forked from jeecp/jeecp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
d2-container-card.spec.js 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
ultimately 提交于 2019-10-07 22:54 . release-vue
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')
})
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mantouo10/jeecp.git
git@gitee.com:mantouo10/jeecp.git
mantouo10
jeecp
jeecp
master

搜索帮助