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
58 lines (46 loc) • 1.33 kB
JavaScript
import { mount } from '@vue/test-utils'
import { BFormDatalist } from './form-datalist'
describe('form-datalist', () => {
it('has root element datalist', async () => {
const wrapper = mount(BFormDatalist, {
propsData: {
id: 'test-list'
}
})
expect(wrapper.element.tagName).toBe('DATALIST')
wrapper.destroy()
})
it('has user supplied ID', async () => {
const wrapper = mount(BFormDatalist, {
propsData: {
id: 'test-list'
}
})
expect(wrapper.attributes('id')).toBe('test-list')
wrapper.destroy()
})
it('has no option elements by default', async () => {
const wrapper = mount(BFormDatalist, {
propsData: {
id: 'test-list'
}
})
expect(wrapper.findAll('option').length).toBe(0)
wrapper.destroy()
})
it('has options when options set', async () => {
const wrapper = mount(BFormDatalist, {
propsData: {
id: 'test-list',
options: ['one', 'two']
}
})
const $options = wrapper.findAll('option')
expect($options.length).toBe(2)
expect($options.at(0).text()).toBe('one')
expect($options.at(1).text()).toBe('two')
expect($options.at(0).attributes('value')).toBe('one')
expect($options.at(1).attributes('value')).toBe('two')
wrapper.destroy()
})
})