forked from EnergySage/es-ds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EsTabs.spec.js
42 lines (37 loc) · 1.21 KB
/
EsTabs.spec.js
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
import { mount } from '@vue/test-utils';
import EsTabs from '@/src/lib-components/EsTabs.vue';
import jestVue from '@/tests/jest.vue.config';
describe('EsTabs', () => {
// Basic test; should exist for most components
test('<EsTabs />', async () => {
const wrapper = mount(EsTabs, {
...jestVue,
});
const a11y = await axe(wrapper.element);
expect(wrapper.vm).toBeTruthy();
expect(wrapper.html()).toMatchSnapshot();
expect(a11y).toHaveNoViolations();
});
// Test border prop is there
test('<EsTabs border=false />', async () => {
const wrapper = mount(EsTabs, {
...jestVue,
propsData: {
border: false,
},
});
expect(wrapper.props('border')).toBe(false);
expect(wrapper.html()).toMatchSnapshot();
});
// Test slot is there
test('<EsTabs>My Content</EsTabs>', async () => {
const wrapper = mount(EsTabs, {
...jestVue,
slots: {
default: 'My Content',
},
});
expect(wrapper.vm.$slots.default[0].text).toBe('My Content');
expect(wrapper.html()).toMatchSnapshot();
});
});