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
51 lines (38 loc) • 1.22 kB
JavaScript
import { mount } from '@vue/test-utils'
import { BNavbarBrand } from './navbar-brand'
describe('navbar-brand', () => {
it('default has tag "div"', async () => {
const wrapper = mount(BNavbarBrand)
expect(wrapper.element.tagName).toBe('DIV')
wrapper.destroy()
})
it('default has class "navbar-brand"', async () => {
const wrapper = mount(BNavbarBrand)
expect(wrapper.classes()).toContain('navbar-brand')
expect(wrapper.classes().length).toBe(1)
wrapper.destroy()
})
it('accepts custom tag', async () => {
const wrapper = mount(BNavbarBrand, {
context: {
props: { tag: 'span' }
}
})
expect(wrapper.element.tagName).toBe('SPAN')
expect(wrapper.classes()).toContain('navbar-brand')
expect(wrapper.classes().length).toBe(1)
wrapper.destroy()
})
it('renders link when href set', async () => {
const wrapper = mount(BNavbarBrand, {
context: {
props: { href: '#foo' }
}
})
expect(wrapper.element.tagName).toBe('A')
expect(wrapper.attributes('href')).toBe('#foo')
expect(wrapper.classes()).toContain('navbar-brand')
expect(wrapper.classes().length).toBe(1)
wrapper.destroy()
})
})