-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCard.test.ts
More file actions
35 lines (25 loc) · 898 Bytes
/
Card.test.ts
File metadata and controls
35 lines (25 loc) · 898 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
import {describe, expect, it} from 'vitest';
import Card from '.';
import {shallowMount} from '@vue/test-utils';
const textPropTest = (propName: string) => {
it(`renders ${propName}`, () => {
const text = `I am a ${propName}`;
const wrapper = shallowMount(Card, {
props: {[propName]: text},
});
expect(wrapper.find(`.card-${propName}`).text()).toBe(text);
});
};
describe('template', () => {
componentRenderTest(Card);
componentSlotRenderTest(Card, 'header');
componentSlotRenderTest(Card);
componentSlotRenderTest(Card, 'footer');
['footer', 'header', 'subtitle', 'text', 'title'].forEach(textPropTest);
it('does not add body class', () => {
const wrapper = shallowMount(Card, {
props: {noBody: true},
});
expect(wrapper.find('.card-body').exists()).toBe(false);
});
});