UNPKG

bootstrap-vue

Version:

With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens

76 lines (62 loc) 1.99 kB
import { mount } from '@vue/test-utils' import { BFormSelectOption } from './form-select-option' describe('form-select-option', () => { it('has expected default structure', async () => { const wrapper = mount(BFormSelectOption, { propsData: { value: 'foo' } }) expect(wrapper.element.tagName).toBe('OPTION') expect(wrapper.attributes('value')).toBeDefined() expect(wrapper.attributes('value')).toEqual('foo') expect(wrapper.text()).toEqual('') wrapper.destroy() }) it('renders default slot content', async () => { const wrapper = mount(BFormSelectOption, { propsData: { value: 'foo' }, slots: { default: 'foobar' } }) expect(wrapper.element.tagName).toBe('OPTION') expect(wrapper.attributes('value')).toBeDefined() expect(wrapper.attributes('value')).toEqual('foo') expect(wrapper.text()).toEqual('foobar') wrapper.destroy() }) it('renders HTML as default slot content', async () => { const wrapper = mount(BFormSelectOption, { propsData: { value: 'foo' }, slots: { default: '<b>Bold</b>' } }) expect(wrapper.element.tagName).toBe('OPTION') expect(wrapper.attributes('value')).toBeDefined() expect(wrapper.attributes('value')).toEqual('foo') const $bold = wrapper.find('b') expect($bold.text()).toEqual('Bold') wrapper.destroy() }) it('has disabled attribute applied when disabled=true', async () => { const wrapper = mount(BFormSelectOption, { propsData: { value: 'foo', disabled: true } }) expect(wrapper.element.tagName).toBe('OPTION') expect(wrapper.attributes('value')).toBeDefined() expect(wrapper.attributes('value')).toEqual('foo') expect(wrapper.attributes('disabled')).toBeDefined() expect(wrapper.attributes('disabled')).toEqual('disabled') expect(wrapper.text()).toEqual('') wrapper.destroy() }) })