-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewRenderer.spec.js
More file actions
42 lines (41 loc) · 1.06 KB
/
Copy pathViewRenderer.spec.js
File metadata and controls
42 lines (41 loc) · 1.06 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
import { mount } from '@vue/test-utils';
import ViewRenderer from '@/components/ViewRenderer.vue';
describe('ViewRenderer.vue', () => {
it('renders custom component', () => {
const wrapper = mount(ViewRenderer, {
propsData: {
config: [
{
elementType: 'custom-component',
attrs: {
id: 'component-1',
// when testing against @vue/test-utils@1.1.4
// remove this line to find the component
name: 'some-name',
prop1: 'some value',
prop2: 123,
},
},
],
},
stubs: {
CustomComponent: {
name: 'CustomComponent',
template: '<div />',
props: [
'name',
'prop1',
'prop2',
],
},
},
});
const cc = wrapper.findComponent({ name: 'CustomComponent' });
expect(cc.exists()).toEqual(true);
expect(cc.props()).toEqual({
name: 'some-name',
prop1: 'some value',
prop2: 123,
});
});
});