card-title.spec.js
939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { mount } from '@vue/test-utils'
import { BCardTitle } from './card-title'
describe('card-title', () => {
it('default has tag "h4"', async () => {
const wrapper = mount(BCardTitle)
expect(wrapper.element.tagName).toBe('H4')
wrapper.destroy()
})
it('default has class "card-title"', async () => {
const wrapper = mount(BCardTitle)
expect(wrapper.classes()).toContain('card-title')
expect(wrapper.classes().length).toBe(1)
wrapper.destroy()
})
it('renders custom tag', async () => {
const wrapper = mount(BCardTitle, {
context: {
props: { titleTag: 'div' }
}
})
expect(wrapper.element.tagName).toBe('DIV')
wrapper.destroy()
})
it('has content from default slot', async () => {
const wrapper = mount(BCardTitle, {
slots: {
default: 'bar'
}
})
expect(wrapper.text()).toContain('bar')
wrapper.destroy()
})
})