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
46 lines (36 loc) • 1.23 kB
JavaScript
import { mount } from '@vue/test-utils'
import { BInputGroupText } from './input-group-text'
describe('input-group > input-group-text', () => {
it('has expected default structure', async () => {
const wrapper = mount(BInputGroupText)
expect(wrapper.element.tagName).toBe('DIV')
expect(wrapper.classes()).toContain('input-group-text')
expect(wrapper.classes().length).toBe(1)
expect(wrapper.text()).toBe('')
wrapper.destroy()
})
it('has custom root element when prop tag set', async () => {
const wrapper = mount(BInputGroupText, {
propsData: {
tag: 'span'
}
})
expect(wrapper.element.tagName).toBe('SPAN')
expect(wrapper.classes()).toContain('input-group-text')
expect(wrapper.classes().length).toBe(1)
expect(wrapper.text()).toBe('')
wrapper.destroy()
})
it('renders content of default slot', async () => {
const wrapper = mount(BInputGroupText, {
slots: {
default: 'foobar'
}
})
expect(wrapper.element.tagName).toBe('DIV')
expect(wrapper.classes()).toContain('input-group-text')
expect(wrapper.classes().length).toBe(1)
expect(wrapper.text()).toBe('foobar')
wrapper.destroy()
})
})