4cd4fd28
郭伟龙
feat: 初始化项目
|
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
import { mount } from '@vue/test-utils'
import { BCardSubTitle } from './card-sub-title'
describe('card-sub-title', () => {
it('default has tag "h6"', async () => {
const wrapper = mount(BCardSubTitle)
expect(wrapper.element.tagName).toBe('H6')
wrapper.destroy()
})
it('default has class "card-subtitle" and "text-muted"', async () => {
const wrapper = mount(BCardSubTitle)
expect(wrapper.classes()).toContain('card-subtitle')
expect(wrapper.classes()).toContain('text-muted')
expect(wrapper.classes().length).toBe(2)
wrapper.destroy()
})
it('renders custom tag', async () => {
const wrapper = mount(BCardSubTitle, {
context: {
props: { subTitleTag: 'div' }
}
})
expect(wrapper.element.tagName).toBe('DIV')
wrapper.destroy()
})
it('accepts subTitleTextVariant value', async () => {
const wrapper = mount(BCardSubTitle, {
context: {
props: { subTitleTextVariant: 'info' }
}
})
expect(wrapper.classes()).toContain('card-subtitle')
expect(wrapper.classes()).toContain('text-info')
expect(wrapper.classes().length).toBe(2)
wrapper.destroy()
})
it('has content from default slot', async () => {
const wrapper = mount(BCardSubTitle, {
slots: {
default: 'foobar'
}
})
expect(wrapper.text()).toContain('foobar')
wrapper.destroy()
})
})
|