-
Notifications
You must be signed in to change notification settings - Fork 391
/
Copy pathLabelRenderer.spec.ts
42 lines (34 loc) · 1.17 KB
/
LabelRenderer.spec.ts
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 { describe, it, expect, beforeEach } from 'vitest';
import { seedIds } from '@jsonforms/core';
import LabelRenderer from '../../../src/additional/LabelRenderer.vue';
import { entry as labelRendererEntry } from '../../../src/additional/LabelRenderer.entry';
import { mountJsonForms } from '../util';
describe('LabelRenderer.vue', () => {
const renderers = [labelRendererEntry];
const data = '';
const schema = {
type: 'string',
};
const uischema = {
type: 'Label',
text: 'My Label',
};
let wrapper: ReturnType<typeof mountJsonForms>;
beforeEach(() => {
// clear all ids to guarantee that the snapshots will always be generated with the same ids
seedIds();
wrapper = mountJsonForms(data, schema, renderers, uischema);
});
it('check if child LabelRenderer exists', () => {
expect(wrapper.getComponent(LabelRenderer));
});
it('renders a label', () => {
expect(wrapper.find('label').exists()).toBe(true);
});
it('renders label text', () => {
expect(wrapper.find('label').text()).toEqual('My Label');
});
it('should render component and match snapshot', () => {
expect(wrapper.html()).toMatchSnapshot();
});
});