Blame view

node_modules/bootstrap-vue/src/components/card/card-text.spec.js 1.01 KB
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
import { mount } from '@vue/test-utils'
import { BCardText } from './card-text'

describe('card-text', () => {
  it('has root element "p"', async () => {
    const wrapper = mount(BCardText)

    expect(wrapper.element.tagName).toBe('P')

    wrapper.destroy()
  })

  it('has class card-text', async () => {
    const wrapper = mount(BCardText)

    expect(wrapper.classes()).toContain('card-text')

    wrapper.destroy()
  })

  it('has custom root element "div" when prop text-tag=div', async () => {
    const wrapper = mount(BCardText, {
      context: {
        props: {
          textTag: 'div'
        }
      }
    })

    expect(wrapper.element.tagName).toBe('DIV')
    expect(wrapper.classes()).toContain('card-text')

    wrapper.destroy()
  })

  it('accepts custom classes', async () => {
    const wrapper = mount(BCardText, {
      context: {
        class: ['foobar']
      }
    })

    expect(wrapper.classes()).toContain('card-text')
    expect(wrapper.classes()).toContain('foobar')

    wrapper.destroy()
  })
})