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