|
| 1 | +import Divider from './dropdown-divider' |
| 2 | +import { mount } from '@vue/test-utils' |
| 3 | + |
| 4 | +describe('dropdown > dropdown-divider', () => { |
| 5 | + it('works', async () => { |
| 6 | + const wrapper = mount('Divider') |
| 7 | + |
| 8 | + expect(wrapper.is('div')).toBe(true) |
| 9 | + expect(wrapper.classes()).toContain('dropdown-divider') |
| 10 | + expect(wrapper.classes().length).toBe(1) |
| 11 | + expect(wrapper.attributes('role')).toBeDefined() |
| 12 | + expect(wrapper.attributes('role')).toEqual('separator') |
| 13 | + expect(wrapper.text()).toEqual('') |
| 14 | + }) |
| 15 | + |
| 16 | + it('renders custom root element when prop tag set', async () => { |
| 17 | + const wrapper = mount('Divider', { |
| 18 | + propsData: { |
| 19 | + tag: 'span' |
| 20 | + } |
| 21 | + }) |
| 22 | + |
| 23 | + expect(wrapper.is('span')).toBe(true) |
| 24 | + expect(wrapper.classes()).toContain('dropdown-divider') |
| 25 | + expect(wrapper.classes().length).toBe(1) |
| 26 | + expect(wrapper.attributes('role')).toBeDefined() |
| 27 | + expect(wrapper.attributes('role')).toEqual('separator') |
| 28 | + expect(wrapper.text()).toEqual('') |
| 29 | + }) |
| 30 | + |
| 31 | + it('does not render default slot content', async () => { |
| 32 | + const wrapper = mount('Divider', { |
| 33 | + slots: { |
| 34 | + default: 'foobar' |
| 35 | + } |
| 36 | + }) |
| 37 | + |
| 38 | + expect(wrapper.is('div')).toBe(true) |
| 39 | + expect(wrapper.classes()).toContain('dropdown-divider') |
| 40 | + expect(wrapper.classes().length).toBe(1) |
| 41 | + expect(wrapper.attributes('role')).toBeDefined() |
| 42 | + expect(wrapper.attributes('role')).toEqual('separator') |
| 43 | + expect(wrapper.text()).toEqual('') |
| 44 | + }) |
| 45 | +}) |
0 commit comments