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
48 lines (38 loc) • 1.28 kB
JavaScript
import { mount } from '@vue/test-utils'
import { BMediaBody } from './media-body'
describe('media-body', () => {
it('has expected default structure', async () => {
const wrapper = mount(BMediaBody)
expect(wrapper.element.tagName).toBe('DIV')
expect(wrapper.classes()).toContain('media-body')
expect(wrapper.classes().length).toBe(1)
expect(wrapper.text()).toEqual('')
wrapper.destroy()
})
it('custom root element when prop `tag` is set', async () => {
const wrapper = mount(BMediaBody, {
propsData: {
tag: 'article'
}
})
expect(wrapper.element.tagName).toBe('ARTICLE')
expect(wrapper.classes()).toContain('media-body')
expect(wrapper.classes().length).toBe(1)
expect(wrapper.text()).toEqual('')
wrapper.destroy()
})
it('renders default slot content', async () => {
const wrapper = mount(BMediaBody, {
slots: {
default: '<b>foobar</b>'
}
})
expect(wrapper.element.tagName).toBe('DIV')
expect(wrapper.classes()).toContain('media-body')
expect(wrapper.classes().length).toBe(1)
expect(wrapper.findAll('b').length).toBe(1)
expect(wrapper.find('b').text()).toEqual('foobar')
expect(wrapper.text()).toEqual('foobar')
wrapper.destroy()
})
})