blob: 2b0fe226a0b81ad5f19695e244c3067e0897782b (
plain)
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
|
import { shallowMount } from '@vue/test-utils';
import EditHeader from '~/static_site_editor/components/edit_header.vue';
import { DEFAULT_HEADING } from '~/static_site_editor/constants';
import { sourceContentTitle } from '../mock_data';
describe('~/static_site_editor/components/edit_header.vue', () => {
let wrapper;
const buildWrapper = (propsData = {}) => {
wrapper = shallowMount(EditHeader, {
propsData: {
...propsData,
},
});
};
const findHeading = () => wrapper.find({ ref: 'sseHeading' });
beforeEach(() => {
buildWrapper();
});
afterEach(() => {
wrapper.destroy();
});
it('renders the default heading if there is no title prop', () => {
expect(findHeading().text()).toBe(DEFAULT_HEADING);
});
it('renders the title prop value in the heading', () => {
buildWrapper({ title: sourceContentTitle });
expect(findHeading().text()).toBe(sourceContentTitle);
});
});
|