-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathnotice_content.test.js
More file actions
68 lines (56 loc) · 1.49 KB
/
notice_content.test.js
File metadata and controls
68 lines (56 loc) · 1.49 KB
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
61
62
63
64
65
66
67
68
import DtNoticeContent from './notice_content.vue';
import { mount } from '@vue/test-utils';
// Constants
const baseProps = {
title: 'this is the title',
titleId: 'titleId555',
contentId: 'contentId888',
};
const baseSlotsData = {
default: 'this is the content',
};
describe('DtNoticeContent tests', () => {
let wrapper;
let props;
let slotsData;
let title;
let content;
const _setWrappers = () => {
props = baseProps;
slotsData = baseSlotsData;
wrapper = mount(DtNoticeContent, {
props,
slots: slotsData,
});
_setChildWrappers();
};
const _setChildWrappers = () => {
title = wrapper.find('#titleId555');
content = wrapper.find('#contentId888');
};
beforeEach(function () {
_setWrappers();
});
describe('Presentation Tests', () => {
describe('When rendered with default content', () => {
it('Should render notice content component', () => {
expect(wrapper.exists()).toBe(true);
});
it('Should display title correctly', () => {
expect(title.text()).toBe(props.title);
});
it('Should display the content correctly', () => {
expect(content.text()).toBe(baseSlotsData.default);
});
});
describe('When title slot is provided', () => {
beforeEach(() => {
slotsData.title = 'this is a slot title';
_setWrappers();
});
it('displays the correct text', () => {
expect(title.text()).toBe(slotsData.title);
});
});
});
});