2020-07-28 13:59:53 +08:00
|
|
|
import { mount } from '@vue/test-utils'
|
2020-07-27 23:22:31 +08:00
|
|
|
import Divider from '../src/index.vue'
|
|
|
|
|
|
|
|
const AXIOM = 'Rem is the best girl'
|
|
|
|
|
|
|
|
describe('Divider.vue', () => {
|
|
|
|
test('render test', () => {
|
|
|
|
const wrapper = mount(Divider, {
|
|
|
|
slots: {
|
|
|
|
default: AXIOM,
|
|
|
|
},
|
|
|
|
})
|
2020-07-28 13:59:53 +08:00
|
|
|
expect(wrapper.text()).toBe(AXIOM)
|
2020-07-27 23:22:31 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
test('direction', () => {
|
2020-07-28 13:59:53 +08:00
|
|
|
const wrapper = mount(Divider, {
|
2020-07-27 23:22:31 +08:00
|
|
|
props: {
|
|
|
|
direction: 'vertical',
|
|
|
|
},
|
|
|
|
})
|
2020-07-28 13:59:53 +08:00
|
|
|
expect(wrapper.classes()).toContain('el-divider--vertical')
|
2020-07-27 23:22:31 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
test('contentPosition', () => {
|
|
|
|
const wrapper = mount(Divider, {
|
|
|
|
slots: {
|
|
|
|
default: AXIOM,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
contentPosition: 'right',
|
|
|
|
},
|
|
|
|
})
|
2020-07-28 13:59:53 +08:00
|
|
|
expect(wrapper.find('.el-divider__text').classes()).toContain('is-right')
|
2020-07-27 23:22:31 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
test('customClass', () => {
|
2020-07-28 13:59:53 +08:00
|
|
|
const wrapper = mount(Divider, {
|
2020-07-27 23:22:31 +08:00
|
|
|
props: {
|
|
|
|
class: 'customClass',
|
|
|
|
},
|
|
|
|
})
|
2020-07-28 13:59:53 +08:00
|
|
|
expect(wrapper.classes()).toContain('customClass')
|
2020-07-27 23:22:31 +08:00
|
|
|
})
|
|
|
|
})
|