bootstrap-vue
Version:
BootstrapVue, with over 40 plugins and more than 80 custom components, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated WAI-ARIA accessibility markup.
39 lines (34 loc) • 1.1 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.is('div')).toBe(true)
})
it('default has class "navbar-brand"', async () => {
const wrapper = mount(BNavbarBrand)
expect(wrapper.classes()).toContain('navbar-brand')
expect(wrapper.classes().length).toBe(1)
})
it('accepts custom tag', async () => {
const wrapper = mount(BNavbarBrand, {
context: {
props: { tag: 'span' }
}
})
expect(wrapper.is('span')).toBe(true)
expect(wrapper.classes()).toContain('navbar-brand')
expect(wrapper.classes().length).toBe(1)
})
it('renders link when href set', async () => {
const wrapper = mount(BNavbarBrand, {
context: {
props: { href: '#foo' }
}
})
expect(wrapper.is('a')).toBe(true)
expect(wrapper.attributes('href')).toBe('#foo')
expect(wrapper.classes()).toContain('navbar-brand')
expect(wrapper.classes().length).toBe(1)
})
})