@rjsf/snapshot-tests 6.0.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/lib/arrayTests.d.ts +1 -6
- package/lib/arrayTests.js +92 -123
- package/lib/arrayTests.js.map +1 -1
- package/lib/formTests.d.ts +1 -10
- package/lib/formTests.js +267 -238
- package/lib/formTests.js.map +1 -1
- package/lib/gridTests.d.ts +1 -2
- package/lib/gridTests.js +23 -35
- package/lib/gridTests.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/objectTests.js +64 -88
- package/lib/objectTests.js.map +1 -1
- package/package.json +9 -8
package/lib/formTests.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import { bracketNameGenerator, dotNotationNameGenerator, } from '@rjsf/utils';
|
|
4
4
|
import validator from '@rjsf/validator-ajv8';
|
|
5
5
|
jest.mock('@rjsf/utils', () => ({
|
|
@@ -7,156 +7,151 @@ jest.mock('@rjsf/utils', () => ({
|
|
|
7
7
|
// Disable the getTestIds within the snapshot tests by returning an empty object
|
|
8
8
|
getTestIds: jest.fn(() => ({})),
|
|
9
9
|
}));
|
|
10
|
-
export
|
|
11
|
-
export const SLIDER_CUSTOMIZE = 'slider';
|
|
12
|
-
export const TEXTAREA_CUSTOMIZE = 'textarea';
|
|
13
|
-
export function formTests(Form, customOptions = {}) {
|
|
10
|
+
export function formTests(Form) {
|
|
14
11
|
describe('single fields', () => {
|
|
15
12
|
describe('string field', () => {
|
|
16
|
-
test('regular', () => {
|
|
13
|
+
test('regular', async () => {
|
|
17
14
|
const schema = {
|
|
18
15
|
type: 'string',
|
|
19
16
|
};
|
|
20
|
-
const
|
|
21
|
-
expect(
|
|
17
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
22
19
|
});
|
|
23
|
-
test('format email', () => {
|
|
20
|
+
test('format email', async () => {
|
|
24
21
|
const schema = {
|
|
25
22
|
type: 'string',
|
|
26
23
|
format: 'email',
|
|
27
24
|
};
|
|
28
|
-
const
|
|
29
|
-
expect(
|
|
25
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
26
|
+
expect(asFragment()).toMatchSnapshot();
|
|
30
27
|
});
|
|
31
|
-
test('format uri', () => {
|
|
28
|
+
test('format uri', async () => {
|
|
32
29
|
const schema = {
|
|
33
30
|
type: 'string',
|
|
34
31
|
format: 'uri',
|
|
35
32
|
};
|
|
36
|
-
const
|
|
37
|
-
expect(
|
|
33
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
34
|
+
expect(asFragment()).toMatchSnapshot();
|
|
38
35
|
});
|
|
39
|
-
test('format data-url', () => {
|
|
36
|
+
test('format data-url', async () => {
|
|
40
37
|
const schema = {
|
|
41
38
|
type: 'string',
|
|
42
39
|
format: 'data-url',
|
|
43
40
|
};
|
|
44
|
-
const
|
|
45
|
-
expect(
|
|
41
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
42
|
+
expect(asFragment()).toMatchSnapshot();
|
|
46
43
|
});
|
|
47
44
|
});
|
|
48
|
-
test('string field with placeholder', () => {
|
|
45
|
+
test('string field with placeholder', async () => {
|
|
49
46
|
const schema = {
|
|
50
47
|
type: 'string',
|
|
51
48
|
};
|
|
52
49
|
const uiSchema = {
|
|
53
50
|
'ui:placeholder': 'placeholder',
|
|
54
51
|
};
|
|
55
|
-
const
|
|
56
|
-
expect(
|
|
52
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
53
|
+
expect(asFragment()).toMatchSnapshot();
|
|
57
54
|
});
|
|
58
|
-
test('number field', () => {
|
|
55
|
+
test('number field', async () => {
|
|
59
56
|
const schema = {
|
|
60
57
|
type: 'number',
|
|
61
58
|
};
|
|
62
|
-
const
|
|
63
|
-
expect(
|
|
59
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
60
|
+
expect(asFragment()).toMatchSnapshot();
|
|
64
61
|
});
|
|
65
|
-
test('number field 0', () => {
|
|
62
|
+
test('number field 0', async () => {
|
|
66
63
|
const schema = {
|
|
67
64
|
type: 'number',
|
|
68
65
|
};
|
|
69
66
|
const formData = 0;
|
|
70
|
-
const
|
|
71
|
-
expect(
|
|
67
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, formData: formData }));
|
|
68
|
+
expect(asFragment()).toMatchSnapshot();
|
|
72
69
|
});
|
|
73
|
-
test('null field', () => {
|
|
70
|
+
test('null field', async () => {
|
|
74
71
|
const schema = {
|
|
75
72
|
type: 'null',
|
|
76
73
|
};
|
|
77
|
-
const
|
|
78
|
-
expect(
|
|
74
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
75
|
+
expect(asFragment()).toMatchSnapshot();
|
|
79
76
|
});
|
|
80
|
-
test('unsupported field', () => {
|
|
77
|
+
test('unsupported field', async () => {
|
|
81
78
|
const schema = {
|
|
82
79
|
type: undefined,
|
|
83
80
|
};
|
|
84
|
-
const
|
|
85
|
-
expect(
|
|
81
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
82
|
+
expect(asFragment()).toMatchSnapshot();
|
|
86
83
|
});
|
|
87
|
-
test('format color', () => {
|
|
84
|
+
test('format color', async () => {
|
|
88
85
|
const schema = {
|
|
89
86
|
type: 'string',
|
|
90
87
|
format: 'color',
|
|
91
88
|
};
|
|
92
|
-
const
|
|
93
|
-
expect(
|
|
89
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
90
|
+
expect(asFragment()).toMatchSnapshot();
|
|
94
91
|
});
|
|
95
|
-
test('format date', () => {
|
|
92
|
+
test('format date', async () => {
|
|
96
93
|
const schema = {
|
|
97
94
|
type: 'string',
|
|
98
95
|
format: 'date',
|
|
99
96
|
};
|
|
100
|
-
const
|
|
101
|
-
expect(
|
|
97
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
98
|
+
expect(asFragment()).toMatchSnapshot();
|
|
102
99
|
});
|
|
103
|
-
test('format datetime', () => {
|
|
100
|
+
test('format datetime', async () => {
|
|
104
101
|
const schema = {
|
|
105
102
|
type: 'string',
|
|
106
103
|
format: 'datetime',
|
|
107
104
|
};
|
|
108
|
-
const
|
|
109
|
-
expect(
|
|
105
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
106
|
+
expect(asFragment()).toMatchSnapshot();
|
|
110
107
|
});
|
|
111
|
-
test('format time', () => {
|
|
108
|
+
test('format time', async () => {
|
|
112
109
|
const schema = {
|
|
113
110
|
type: 'string',
|
|
114
111
|
format: 'time',
|
|
115
112
|
};
|
|
116
|
-
const
|
|
117
|
-
expect(
|
|
113
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
114
|
+
expect(asFragment()).toMatchSnapshot();
|
|
118
115
|
});
|
|
119
|
-
test('password field', () => {
|
|
116
|
+
test('password field', async () => {
|
|
120
117
|
const schema = {
|
|
121
118
|
type: 'string',
|
|
122
119
|
};
|
|
123
120
|
const uiSchema = {
|
|
124
121
|
'ui:widget': 'password',
|
|
125
122
|
};
|
|
126
|
-
const
|
|
127
|
-
expect(
|
|
123
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
124
|
+
expect(asFragment()).toMatchSnapshot();
|
|
128
125
|
});
|
|
129
|
-
test('up/down field', () => {
|
|
126
|
+
test('up/down field', async () => {
|
|
130
127
|
const schema = {
|
|
131
128
|
type: 'number',
|
|
132
129
|
};
|
|
133
130
|
const uiSchema = {
|
|
134
131
|
'ui:widget': 'updown',
|
|
135
132
|
};
|
|
136
|
-
const
|
|
137
|
-
expect(
|
|
133
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
134
|
+
expect(asFragment()).toMatchSnapshot();
|
|
138
135
|
});
|
|
139
|
-
test('textarea field', () => {
|
|
136
|
+
test('textarea field', async () => {
|
|
140
137
|
const schema = {
|
|
141
138
|
type: 'string',
|
|
142
139
|
};
|
|
143
140
|
const uiSchema = {
|
|
144
141
|
'ui:widget': 'textarea',
|
|
145
142
|
};
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
.toJSON();
|
|
149
|
-
expect(tree).toMatchSnapshot();
|
|
143
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
144
|
+
expect(asFragment()).toMatchSnapshot();
|
|
150
145
|
});
|
|
151
|
-
test('select field', () => {
|
|
146
|
+
test('select field', async () => {
|
|
152
147
|
const schema = {
|
|
153
148
|
type: 'string',
|
|
154
149
|
enum: ['foo', 'bar'],
|
|
155
150
|
};
|
|
156
|
-
const
|
|
157
|
-
expect(
|
|
151
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
152
|
+
expect(asFragment()).toMatchSnapshot();
|
|
158
153
|
});
|
|
159
|
-
test('select field multiple choice', () => {
|
|
154
|
+
test('select field multiple choice', async () => {
|
|
160
155
|
const schema = {
|
|
161
156
|
type: 'array',
|
|
162
157
|
items: {
|
|
@@ -165,12 +160,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
165
160
|
},
|
|
166
161
|
uniqueItems: true,
|
|
167
162
|
};
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
.toJSON();
|
|
171
|
-
expect(tree).toMatchSnapshot();
|
|
163
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
164
|
+
expect(asFragment()).toMatchSnapshot();
|
|
172
165
|
});
|
|
173
|
-
test('select field multiple choice with labels', () => {
|
|
166
|
+
test('select field multiple choice with labels', async () => {
|
|
174
167
|
const schema = {
|
|
175
168
|
type: 'array',
|
|
176
169
|
items: {
|
|
@@ -192,12 +185,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
192
185
|
},
|
|
193
186
|
uniqueItems: true,
|
|
194
187
|
};
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
.toJSON();
|
|
198
|
-
expect(tree).toMatchSnapshot();
|
|
188
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
189
|
+
expect(asFragment()).toMatchSnapshot();
|
|
199
190
|
});
|
|
200
|
-
test('select field single choice enumDisabled', () => {
|
|
191
|
+
test('select field single choice enumDisabled', async () => {
|
|
201
192
|
const schema = {
|
|
202
193
|
type: 'string',
|
|
203
194
|
enum: ['foo', 'bar'],
|
|
@@ -205,10 +196,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
205
196
|
const uiSchema = {
|
|
206
197
|
'ui:enumDisabled': ['bar'],
|
|
207
198
|
};
|
|
208
|
-
const
|
|
209
|
-
expect(
|
|
199
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
200
|
+
expect(asFragment()).toMatchSnapshot();
|
|
210
201
|
});
|
|
211
|
-
test('select field single choice enumDisabled using radio widget', () => {
|
|
202
|
+
test('select field single choice enumDisabled using radio widget', async () => {
|
|
212
203
|
const schema = {
|
|
213
204
|
type: 'string',
|
|
214
205
|
enum: ['foo', 'bar'],
|
|
@@ -217,10 +208,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
217
208
|
'ui:widget': 'radio',
|
|
218
209
|
'ui:enumDisabled': ['bar'],
|
|
219
210
|
};
|
|
220
|
-
const
|
|
221
|
-
expect(
|
|
211
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
212
|
+
expect(asFragment()).toMatchSnapshot();
|
|
222
213
|
});
|
|
223
|
-
test('select field single choice uiSchema disabled using radio widget', () => {
|
|
214
|
+
test('select field single choice uiSchema disabled using radio widget', async () => {
|
|
224
215
|
const schema = {
|
|
225
216
|
type: 'string',
|
|
226
217
|
enum: ['foo', 'bar'],
|
|
@@ -229,10 +220,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
229
220
|
'ui:widget': 'radio',
|
|
230
221
|
'ui:disabled': true,
|
|
231
222
|
};
|
|
232
|
-
const
|
|
233
|
-
expect(
|
|
223
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
224
|
+
expect(asFragment()).toMatchSnapshot();
|
|
234
225
|
});
|
|
235
|
-
test('select field single choice form disabled using radio widget', () => {
|
|
226
|
+
test('select field single choice form disabled using radio widget', async () => {
|
|
236
227
|
const schema = {
|
|
237
228
|
type: 'string',
|
|
238
229
|
enum: ['foo', 'bar'],
|
|
@@ -240,12 +231,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
240
231
|
const uiSchema = {
|
|
241
232
|
'ui:widget': 'radio',
|
|
242
233
|
};
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
.toJSON();
|
|
246
|
-
expect(tree).toMatchSnapshot();
|
|
234
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator, disabled: true }));
|
|
235
|
+
expect(asFragment()).toMatchSnapshot();
|
|
247
236
|
});
|
|
248
|
-
test('select field multiple choice enumDisabled', () => {
|
|
237
|
+
test('select field multiple choice enumDisabled', async () => {
|
|
249
238
|
const schema = {
|
|
250
239
|
type: 'array',
|
|
251
240
|
items: {
|
|
@@ -257,12 +246,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
257
246
|
const uiSchema = {
|
|
258
247
|
'ui:enumDisabled': ['bar'],
|
|
259
248
|
};
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
.toJSON();
|
|
263
|
-
expect(tree).toMatchSnapshot();
|
|
249
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
250
|
+
expect(asFragment()).toMatchSnapshot();
|
|
264
251
|
});
|
|
265
|
-
test('select field multiple choice enumDisabled using checkboxes', () => {
|
|
252
|
+
test('select field multiple choice enumDisabled using checkboxes', async () => {
|
|
266
253
|
const schema = {
|
|
267
254
|
type: 'array',
|
|
268
255
|
items: {
|
|
@@ -275,21 +262,59 @@ export function formTests(Form, customOptions = {}) {
|
|
|
275
262
|
'ui:widget': 'checkboxes',
|
|
276
263
|
'ui:enumDisabled': ['bar'],
|
|
277
264
|
};
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
.toJSON();
|
|
281
|
-
expect(tree).toMatchSnapshot();
|
|
265
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
266
|
+
expect(asFragment()).toMatchSnapshot();
|
|
282
267
|
});
|
|
283
|
-
test('
|
|
268
|
+
test('checkboxes widget with custom options and labels', () => {
|
|
269
|
+
const schema = {
|
|
270
|
+
type: 'array',
|
|
271
|
+
title: 'Checkbox Group',
|
|
272
|
+
description: 'A group of checkboxes',
|
|
273
|
+
items: {
|
|
274
|
+
type: 'string',
|
|
275
|
+
enum: ['option1', 'option2', 'option3'],
|
|
276
|
+
},
|
|
277
|
+
uniqueItems: true,
|
|
278
|
+
};
|
|
279
|
+
const uiSchema = {
|
|
280
|
+
'ui:widget': 'checkboxes',
|
|
281
|
+
'ui:options': {
|
|
282
|
+
inline: true,
|
|
283
|
+
help: 'Select all that apply',
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
const formData = ['option1'];
|
|
287
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, formData: formData, validator: validator }));
|
|
288
|
+
expect(asFragment()).toMatchSnapshot();
|
|
289
|
+
});
|
|
290
|
+
test('checkboxes widget with required field', () => {
|
|
291
|
+
const schema = {
|
|
292
|
+
type: 'array',
|
|
293
|
+
title: 'Required Checkbox Group',
|
|
294
|
+
description: 'At least one option must be selected',
|
|
295
|
+
items: {
|
|
296
|
+
type: 'string',
|
|
297
|
+
enum: ['red', 'green', 'blue'],
|
|
298
|
+
},
|
|
299
|
+
minItems: 1,
|
|
300
|
+
uniqueItems: true,
|
|
301
|
+
};
|
|
302
|
+
const uiSchema = {
|
|
303
|
+
'ui:widget': 'checkboxes',
|
|
304
|
+
};
|
|
305
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
306
|
+
expect(asFragment()).toMatchSnapshot();
|
|
307
|
+
});
|
|
308
|
+
test('select field single choice formData', async () => {
|
|
284
309
|
const schema = {
|
|
285
310
|
type: 'string',
|
|
286
311
|
enum: ['foo', 'bar'],
|
|
287
312
|
};
|
|
288
313
|
const formData = 'bar';
|
|
289
|
-
const
|
|
290
|
-
expect(
|
|
314
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, formData: formData, validator: validator }));
|
|
315
|
+
expect(asFragment()).toMatchSnapshot();
|
|
291
316
|
});
|
|
292
|
-
test('select field multiple choice formData', () => {
|
|
317
|
+
test('select field multiple choice formData', async () => {
|
|
293
318
|
const schema = {
|
|
294
319
|
type: 'array',
|
|
295
320
|
items: {
|
|
@@ -299,46 +324,80 @@ export function formTests(Form, customOptions = {}) {
|
|
|
299
324
|
uniqueItems: true,
|
|
300
325
|
};
|
|
301
326
|
const formData = ['foo', 'bar'];
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
.toJSON();
|
|
305
|
-
expect(tree).toMatchSnapshot();
|
|
327
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, formData: formData, validator: validator }));
|
|
328
|
+
expect(asFragment()).toMatchSnapshot();
|
|
306
329
|
});
|
|
307
|
-
test('checkbox field', () => {
|
|
330
|
+
test('checkbox field', async () => {
|
|
308
331
|
const schema = {
|
|
309
332
|
type: 'boolean',
|
|
310
333
|
};
|
|
311
|
-
const
|
|
312
|
-
expect(
|
|
334
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
335
|
+
expect(asFragment()).toMatchSnapshot();
|
|
313
336
|
});
|
|
314
|
-
test('checkbox field with label', () => {
|
|
337
|
+
test('checkbox field with label', async () => {
|
|
315
338
|
const schema = {
|
|
316
339
|
type: 'boolean',
|
|
317
340
|
title: 'test',
|
|
318
341
|
};
|
|
319
|
-
const
|
|
320
|
-
expect(
|
|
342
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
343
|
+
expect(asFragment()).toMatchSnapshot();
|
|
321
344
|
});
|
|
322
|
-
test('checkbox field with label and description', () => {
|
|
345
|
+
test('checkbox field with label and description', async () => {
|
|
323
346
|
const schema = {
|
|
324
347
|
type: 'boolean',
|
|
325
348
|
title: 'test',
|
|
326
349
|
description: 'test description',
|
|
327
350
|
};
|
|
328
|
-
const
|
|
329
|
-
expect(
|
|
351
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
352
|
+
expect(asFragment()).toMatchSnapshot();
|
|
330
353
|
});
|
|
331
|
-
test('checkbox field with label and rich text description', () => {
|
|
354
|
+
test('checkbox field with label and rich text description', async () => {
|
|
332
355
|
const schema = {
|
|
333
356
|
type: 'boolean',
|
|
334
357
|
title: 'test',
|
|
335
358
|
description: '**test** __description__',
|
|
336
359
|
};
|
|
337
360
|
const uiSchema = { 'ui:enableMarkdownInDescription': true };
|
|
338
|
-
const
|
|
339
|
-
expect(
|
|
361
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
362
|
+
expect(asFragment()).toMatchSnapshot();
|
|
363
|
+
});
|
|
364
|
+
test('checkbox field with description in schema and FieldTemplate', async () => {
|
|
365
|
+
const schema = {
|
|
366
|
+
type: 'boolean',
|
|
367
|
+
title: 'test',
|
|
368
|
+
description: 'This is a checkbox description',
|
|
369
|
+
};
|
|
370
|
+
const uiSchema = {
|
|
371
|
+
'ui:widget': 'checkbox',
|
|
372
|
+
};
|
|
373
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
374
|
+
expect(asFragment()).toMatchSnapshot();
|
|
375
|
+
});
|
|
376
|
+
test('radio widget with description in schema and FieldTemplate', async () => {
|
|
377
|
+
const schema = {
|
|
378
|
+
type: 'boolean',
|
|
379
|
+
title: 'test',
|
|
380
|
+
description: 'This is a radio description',
|
|
381
|
+
};
|
|
382
|
+
const uiSchema = {
|
|
383
|
+
'ui:widget': 'radio',
|
|
384
|
+
};
|
|
385
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
386
|
+
expect(asFragment()).toMatchSnapshot();
|
|
387
|
+
});
|
|
388
|
+
test('select widget with description in schema and FieldTemplate', async () => {
|
|
389
|
+
const schema = {
|
|
390
|
+
type: 'boolean',
|
|
391
|
+
title: 'test',
|
|
392
|
+
description: 'This is a select description',
|
|
393
|
+
};
|
|
394
|
+
const uiSchema = {
|
|
395
|
+
'ui:widget': 'select',
|
|
396
|
+
};
|
|
397
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
398
|
+
expect(asFragment()).toMatchSnapshot();
|
|
340
399
|
});
|
|
341
|
-
test('checkboxes field', () => {
|
|
400
|
+
test('checkboxes field', async () => {
|
|
342
401
|
const schema = {
|
|
343
402
|
type: 'array',
|
|
344
403
|
title: 'An enum list rendered as checkboxes',
|
|
@@ -351,20 +410,20 @@ export function formTests(Form, customOptions = {}) {
|
|
|
351
410
|
const uiSchema = {
|
|
352
411
|
'ui:widget': 'checkboxes',
|
|
353
412
|
};
|
|
354
|
-
const
|
|
355
|
-
expect(
|
|
413
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
414
|
+
expect(asFragment()).toMatchSnapshot();
|
|
356
415
|
});
|
|
357
|
-
test('radio field', () => {
|
|
416
|
+
test('radio field', async () => {
|
|
358
417
|
const schema = {
|
|
359
418
|
type: 'boolean',
|
|
360
419
|
};
|
|
361
420
|
const uiSchema = {
|
|
362
421
|
'ui:widget': 'radio',
|
|
363
422
|
};
|
|
364
|
-
const
|
|
365
|
-
expect(
|
|
423
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
424
|
+
expect(asFragment()).toMatchSnapshot();
|
|
366
425
|
});
|
|
367
|
-
test('slider field', () => {
|
|
426
|
+
test('slider field', async () => {
|
|
368
427
|
const schema = {
|
|
369
428
|
type: 'integer',
|
|
370
429
|
minimum: 42,
|
|
@@ -373,12 +432,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
373
432
|
const uiSchema = {
|
|
374
433
|
'ui:widget': 'range',
|
|
375
434
|
};
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
.toJSON();
|
|
379
|
-
expect(tree).toMatchSnapshot();
|
|
435
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema, formData: 75 }));
|
|
436
|
+
expect(asFragment()).toMatchSnapshot();
|
|
380
437
|
});
|
|
381
|
-
test('hidden field', () => {
|
|
438
|
+
test('hidden field', async () => {
|
|
382
439
|
const schema = {
|
|
383
440
|
type: 'object',
|
|
384
441
|
properties: {
|
|
@@ -392,10 +449,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
392
449
|
'ui:widget': 'hidden',
|
|
393
450
|
},
|
|
394
451
|
};
|
|
395
|
-
const
|
|
396
|
-
expect(
|
|
452
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
453
|
+
expect(asFragment()).toMatchSnapshot();
|
|
397
454
|
});
|
|
398
|
-
test('field with description', () => {
|
|
455
|
+
test('field with description', async () => {
|
|
399
456
|
const schema = {
|
|
400
457
|
type: 'object',
|
|
401
458
|
properties: {
|
|
@@ -405,10 +462,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
405
462
|
},
|
|
406
463
|
},
|
|
407
464
|
};
|
|
408
|
-
const
|
|
409
|
-
expect(
|
|
465
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
466
|
+
expect(asFragment()).toMatchSnapshot();
|
|
410
467
|
});
|
|
411
|
-
test('field with description in uiSchema', () => {
|
|
468
|
+
test('field with description in uiSchema', async () => {
|
|
412
469
|
const schema = {
|
|
413
470
|
type: 'object',
|
|
414
471
|
properties: {
|
|
@@ -423,10 +480,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
423
480
|
'ui:description': 'some other description',
|
|
424
481
|
},
|
|
425
482
|
};
|
|
426
|
-
const
|
|
427
|
-
expect(
|
|
483
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
484
|
+
expect(asFragment()).toMatchSnapshot();
|
|
428
485
|
});
|
|
429
|
-
test('field with markdown description', () => {
|
|
486
|
+
test('field with markdown description', async () => {
|
|
430
487
|
const schema = {
|
|
431
488
|
type: 'object',
|
|
432
489
|
properties: {
|
|
@@ -439,10 +496,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
439
496
|
const uiSchema = {
|
|
440
497
|
'my-field': { 'ui:enableMarkdownInDescription': true },
|
|
441
498
|
};
|
|
442
|
-
const
|
|
443
|
-
expect(
|
|
499
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator }));
|
|
500
|
+
expect(asFragment()).toMatchSnapshot();
|
|
444
501
|
});
|
|
445
|
-
test('field with markdown description in uiSchema', () => {
|
|
502
|
+
test('field with markdown description in uiSchema', async () => {
|
|
446
503
|
const schema = {
|
|
447
504
|
type: 'object',
|
|
448
505
|
properties: {
|
|
@@ -458,10 +515,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
458
515
|
'ui:enableMarkdownInDescription': true,
|
|
459
516
|
},
|
|
460
517
|
};
|
|
461
|
-
const
|
|
462
|
-
expect(
|
|
518
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
519
|
+
expect(asFragment()).toMatchSnapshot();
|
|
463
520
|
});
|
|
464
|
-
test('title field', () => {
|
|
521
|
+
test('title field', async () => {
|
|
465
522
|
const schema = {
|
|
466
523
|
type: 'object',
|
|
467
524
|
properties: {
|
|
@@ -476,10 +533,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
476
533
|
'ui:title': 'Titre 2',
|
|
477
534
|
},
|
|
478
535
|
};
|
|
479
|
-
const
|
|
480
|
-
expect(
|
|
536
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
537
|
+
expect(asFragment()).toMatchSnapshot();
|
|
481
538
|
});
|
|
482
|
-
test('hidden label', () => {
|
|
539
|
+
test('hidden label', async () => {
|
|
483
540
|
const schema = {
|
|
484
541
|
type: 'string',
|
|
485
542
|
};
|
|
@@ -488,25 +545,25 @@ export function formTests(Form, customOptions = {}) {
|
|
|
488
545
|
label: false,
|
|
489
546
|
},
|
|
490
547
|
};
|
|
491
|
-
const
|
|
492
|
-
expect(
|
|
548
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, uiSchema: uiSchema }));
|
|
549
|
+
expect(asFragment()).toMatchSnapshot();
|
|
493
550
|
});
|
|
494
|
-
test('using custom tagName', () => {
|
|
551
|
+
test('using custom tagName', async () => {
|
|
495
552
|
const schema = {
|
|
496
553
|
type: 'string',
|
|
497
554
|
};
|
|
498
|
-
const
|
|
499
|
-
expect(
|
|
555
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, tagName: 'div' }));
|
|
556
|
+
expect(asFragment()).toMatchSnapshot();
|
|
500
557
|
});
|
|
501
|
-
test('schema examples', () => {
|
|
558
|
+
test('schema examples', async () => {
|
|
502
559
|
const schema = {
|
|
503
560
|
type: 'string',
|
|
504
561
|
examples: ['Firefox', 'Chrome', 'Opera', 'Vivaldi', 'Safari'],
|
|
505
562
|
};
|
|
506
|
-
const
|
|
507
|
-
expect(
|
|
563
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator }));
|
|
564
|
+
expect(asFragment()).toMatchSnapshot();
|
|
508
565
|
});
|
|
509
|
-
test('help and error display', () => {
|
|
566
|
+
test('help and error display', async () => {
|
|
510
567
|
const schema = {
|
|
511
568
|
type: 'string',
|
|
512
569
|
};
|
|
@@ -515,10 +572,8 @@ export function formTests(Form, customOptions = {}) {
|
|
|
515
572
|
};
|
|
516
573
|
const errors = ['an error'];
|
|
517
574
|
const extraErrors = { __errors: errors };
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
.toJSON();
|
|
521
|
-
expect(tree).toMatchSnapshot();
|
|
575
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator, extraErrors: extraErrors }));
|
|
576
|
+
expect(asFragment()).toMatchSnapshot();
|
|
522
577
|
});
|
|
523
578
|
describe('optional data controls', () => {
|
|
524
579
|
let schema;
|
|
@@ -693,27 +748,27 @@ export function formTests(Form, customOptions = {}) {
|
|
|
693
748
|
nestedArrayOptional: ['bar'],
|
|
694
749
|
};
|
|
695
750
|
});
|
|
696
|
-
test('does not show optional controls when not turned on in uiSchema and no formData', () => {
|
|
751
|
+
test('does not show optional controls when not turned on in uiSchema and no formData', async () => {
|
|
697
752
|
const formProps = {
|
|
698
753
|
schema,
|
|
699
754
|
uiSchema: {},
|
|
700
755
|
validator,
|
|
701
756
|
experimental_defaultFormStateBehavior,
|
|
702
757
|
};
|
|
703
|
-
const
|
|
704
|
-
expect(
|
|
758
|
+
const { asFragment } = render(_jsx(Form, { ...formProps }));
|
|
759
|
+
expect(asFragment()).toMatchSnapshot();
|
|
705
760
|
});
|
|
706
|
-
test('shows "add" optional controls when turned on in uiSchema and no formData', () => {
|
|
761
|
+
test('shows "add" optional controls when turned on in uiSchema and no formData', async () => {
|
|
707
762
|
const formProps = {
|
|
708
763
|
schema,
|
|
709
764
|
uiSchema,
|
|
710
765
|
validator,
|
|
711
766
|
experimental_defaultFormStateBehavior,
|
|
712
767
|
};
|
|
713
|
-
const
|
|
714
|
-
expect(
|
|
768
|
+
const { asFragment } = render(_jsx(Form, { ...formProps }));
|
|
769
|
+
expect(asFragment()).toMatchSnapshot();
|
|
715
770
|
});
|
|
716
|
-
test('shows "add" and "remove" optional controls when turned on in uiSchema and formData', () => {
|
|
771
|
+
test('shows "add" and "remove" optional controls when turned on in uiSchema and formData', async () => {
|
|
717
772
|
const formProps = {
|
|
718
773
|
schema,
|
|
719
774
|
uiSchema,
|
|
@@ -721,10 +776,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
721
776
|
experimental_defaultFormStateBehavior,
|
|
722
777
|
formData,
|
|
723
778
|
};
|
|
724
|
-
const
|
|
725
|
-
expect(
|
|
779
|
+
const { asFragment } = render(_jsx(Form, { ...formProps }));
|
|
780
|
+
expect(asFragment()).toMatchSnapshot();
|
|
726
781
|
});
|
|
727
|
-
test('does not show optional controls when not turned on in uiSchema, readonly and no formData', () => {
|
|
782
|
+
test('does not show optional controls when not turned on in uiSchema, readonly and no formData', async () => {
|
|
728
783
|
const formProps = {
|
|
729
784
|
schema,
|
|
730
785
|
uiSchema: {},
|
|
@@ -732,10 +787,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
732
787
|
experimental_defaultFormStateBehavior,
|
|
733
788
|
readonly: true,
|
|
734
789
|
};
|
|
735
|
-
const
|
|
736
|
-
expect(
|
|
790
|
+
const { asFragment } = render(_jsx(Form, { ...formProps }));
|
|
791
|
+
expect(asFragment()).toMatchSnapshot();
|
|
737
792
|
});
|
|
738
|
-
test('shows "add" optional controls when turned on in uiSchema, disabled and no formData', () => {
|
|
793
|
+
test('shows "add" optional controls when turned on in uiSchema, disabled and no formData', async () => {
|
|
739
794
|
const formProps = {
|
|
740
795
|
schema,
|
|
741
796
|
uiSchema,
|
|
@@ -743,10 +798,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
743
798
|
experimental_defaultFormStateBehavior,
|
|
744
799
|
disabled: true,
|
|
745
800
|
};
|
|
746
|
-
const
|
|
747
|
-
expect(
|
|
801
|
+
const { asFragment } = render(_jsx(Form, { ...formProps }));
|
|
802
|
+
expect(asFragment()).toMatchSnapshot();
|
|
748
803
|
});
|
|
749
|
-
test('shows "add" and "remove" optional controls when turned on in uiSchema, readonly and formData', () => {
|
|
804
|
+
test('shows "add" and "remove" optional controls when turned on in uiSchema, readonly and formData', async () => {
|
|
750
805
|
const formProps = {
|
|
751
806
|
schema,
|
|
752
807
|
uiSchema,
|
|
@@ -755,14 +810,14 @@ export function formTests(Form, customOptions = {}) {
|
|
|
755
810
|
formData,
|
|
756
811
|
readonly: true,
|
|
757
812
|
};
|
|
758
|
-
const
|
|
759
|
-
expect(
|
|
813
|
+
const { asFragment } = render(_jsx(Form, { ...formProps }));
|
|
814
|
+
expect(asFragment()).toMatchSnapshot();
|
|
760
815
|
});
|
|
761
816
|
});
|
|
762
817
|
});
|
|
763
818
|
describe('nameGenerator', () => {
|
|
764
819
|
describe('bracketNameGenerator', () => {
|
|
765
|
-
test('simple fields', () => {
|
|
820
|
+
test('simple fields', async () => {
|
|
766
821
|
const schema = {
|
|
767
822
|
type: 'object',
|
|
768
823
|
properties: {
|
|
@@ -777,12 +832,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
777
832
|
},
|
|
778
833
|
},
|
|
779
834
|
};
|
|
780
|
-
const
|
|
781
|
-
|
|
782
|
-
.toJSON();
|
|
783
|
-
expect(tree).toMatchSnapshot();
|
|
835
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, nameGenerator: bracketNameGenerator }));
|
|
836
|
+
expect(asFragment()).toMatchSnapshot();
|
|
784
837
|
});
|
|
785
|
-
test('nested object', () => {
|
|
838
|
+
test('nested object', async () => {
|
|
786
839
|
const schema = {
|
|
787
840
|
type: 'object',
|
|
788
841
|
properties: {
|
|
@@ -810,12 +863,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
810
863
|
},
|
|
811
864
|
},
|
|
812
865
|
};
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
.toJSON();
|
|
816
|
-
expect(tree).toMatchSnapshot();
|
|
866
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, nameGenerator: bracketNameGenerator }));
|
|
867
|
+
expect(asFragment()).toMatchSnapshot();
|
|
817
868
|
});
|
|
818
|
-
test('array of strings', () => {
|
|
869
|
+
test('array of strings', async () => {
|
|
819
870
|
const schema = {
|
|
820
871
|
type: 'object',
|
|
821
872
|
properties: {
|
|
@@ -828,12 +879,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
828
879
|
},
|
|
829
880
|
};
|
|
830
881
|
const formData = { tags: ['foo', 'bar'] };
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
.toJSON();
|
|
834
|
-
expect(tree).toMatchSnapshot();
|
|
882
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, formData: formData, validator: validator, nameGenerator: bracketNameGenerator }));
|
|
883
|
+
expect(asFragment()).toMatchSnapshot();
|
|
835
884
|
});
|
|
836
|
-
test('array of objects', () => {
|
|
885
|
+
test('array of objects', async () => {
|
|
837
886
|
const schema = {
|
|
838
887
|
type: 'object',
|
|
839
888
|
properties: {
|
|
@@ -859,12 +908,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
859
908
|
{ title: 'Task 2', done: true },
|
|
860
909
|
],
|
|
861
910
|
};
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
.toJSON();
|
|
865
|
-
expect(tree).toMatchSnapshot();
|
|
911
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, formData: formData, validator: validator, nameGenerator: bracketNameGenerator }));
|
|
912
|
+
expect(asFragment()).toMatchSnapshot();
|
|
866
913
|
});
|
|
867
|
-
test('select field with enum', () => {
|
|
914
|
+
test('select field with enum', async () => {
|
|
868
915
|
const schema = {
|
|
869
916
|
type: 'object',
|
|
870
917
|
properties: {
|
|
@@ -874,12 +921,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
874
921
|
},
|
|
875
922
|
},
|
|
876
923
|
};
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
.toJSON();
|
|
880
|
-
expect(tree).toMatchSnapshot();
|
|
924
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, nameGenerator: bracketNameGenerator }));
|
|
925
|
+
expect(asFragment()).toMatchSnapshot();
|
|
881
926
|
});
|
|
882
|
-
test('radio field', () => {
|
|
927
|
+
test('radio field', async () => {
|
|
883
928
|
const schema = {
|
|
884
929
|
type: 'object',
|
|
885
930
|
properties: {
|
|
@@ -894,12 +939,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
894
939
|
'ui:widget': 'radio',
|
|
895
940
|
},
|
|
896
941
|
};
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
.toJSON();
|
|
900
|
-
expect(tree).toMatchSnapshot();
|
|
942
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator, nameGenerator: bracketNameGenerator }));
|
|
943
|
+
expect(asFragment()).toMatchSnapshot();
|
|
901
944
|
});
|
|
902
|
-
test('checkboxes field', () => {
|
|
945
|
+
test('checkboxes field', async () => {
|
|
903
946
|
const schema = {
|
|
904
947
|
type: 'object',
|
|
905
948
|
properties: {
|
|
@@ -918,12 +961,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
918
961
|
'ui:widget': 'checkboxes',
|
|
919
962
|
},
|
|
920
963
|
};
|
|
921
|
-
const
|
|
922
|
-
|
|
923
|
-
.toJSON();
|
|
924
|
-
expect(tree).toMatchSnapshot();
|
|
964
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator, nameGenerator: bracketNameGenerator }));
|
|
965
|
+
expect(asFragment()).toMatchSnapshot();
|
|
925
966
|
});
|
|
926
|
-
test('textarea field', () => {
|
|
967
|
+
test('textarea field', async () => {
|
|
927
968
|
const schema = {
|
|
928
969
|
type: 'object',
|
|
929
970
|
properties: {
|
|
@@ -937,14 +978,12 @@ export function formTests(Form, customOptions = {}) {
|
|
|
937
978
|
'ui:widget': 'textarea',
|
|
938
979
|
},
|
|
939
980
|
};
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
.toJSON();
|
|
943
|
-
expect(tree).toMatchSnapshot();
|
|
981
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, uiSchema: uiSchema, validator: validator, nameGenerator: bracketNameGenerator }));
|
|
982
|
+
expect(asFragment()).toMatchSnapshot();
|
|
944
983
|
});
|
|
945
984
|
});
|
|
946
985
|
describe('dotNotationNameGenerator', () => {
|
|
947
|
-
test('simple fields', () => {
|
|
986
|
+
test('simple fields', async () => {
|
|
948
987
|
const schema = {
|
|
949
988
|
type: 'object',
|
|
950
989
|
properties: {
|
|
@@ -959,12 +998,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
959
998
|
},
|
|
960
999
|
},
|
|
961
1000
|
};
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
.toJSON();
|
|
965
|
-
expect(tree).toMatchSnapshot();
|
|
1001
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, nameGenerator: dotNotationNameGenerator }));
|
|
1002
|
+
expect(asFragment()).toMatchSnapshot();
|
|
966
1003
|
});
|
|
967
|
-
test('nested object', () => {
|
|
1004
|
+
test('nested object', async () => {
|
|
968
1005
|
const schema = {
|
|
969
1006
|
type: 'object',
|
|
970
1007
|
properties: {
|
|
@@ -992,12 +1029,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
992
1029
|
},
|
|
993
1030
|
},
|
|
994
1031
|
};
|
|
995
|
-
const
|
|
996
|
-
|
|
997
|
-
.toJSON();
|
|
998
|
-
expect(tree).toMatchSnapshot();
|
|
1032
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, nameGenerator: dotNotationNameGenerator }));
|
|
1033
|
+
expect(asFragment()).toMatchSnapshot();
|
|
999
1034
|
});
|
|
1000
|
-
test('array of strings', () => {
|
|
1035
|
+
test('array of strings', async () => {
|
|
1001
1036
|
const schema = {
|
|
1002
1037
|
type: 'object',
|
|
1003
1038
|
properties: {
|
|
@@ -1010,12 +1045,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
1010
1045
|
},
|
|
1011
1046
|
};
|
|
1012
1047
|
const formData = { tags: ['foo', 'bar'] };
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1015
|
-
.toJSON();
|
|
1016
|
-
expect(tree).toMatchSnapshot();
|
|
1048
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, formData: formData, validator: validator, nameGenerator: dotNotationNameGenerator }));
|
|
1049
|
+
expect(asFragment()).toMatchSnapshot();
|
|
1017
1050
|
});
|
|
1018
|
-
test('array of objects', () => {
|
|
1051
|
+
test('array of objects', async () => {
|
|
1019
1052
|
const schema = {
|
|
1020
1053
|
type: 'object',
|
|
1021
1054
|
properties: {
|
|
@@ -1041,12 +1074,10 @@ export function formTests(Form, customOptions = {}) {
|
|
|
1041
1074
|
{ title: 'Task 2', done: true },
|
|
1042
1075
|
],
|
|
1043
1076
|
};
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
.toJSON();
|
|
1047
|
-
expect(tree).toMatchSnapshot();
|
|
1077
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, formData: formData, validator: validator, nameGenerator: dotNotationNameGenerator }));
|
|
1078
|
+
expect(asFragment()).toMatchSnapshot();
|
|
1048
1079
|
});
|
|
1049
|
-
test('select field with enum', () => {
|
|
1080
|
+
test('select field with enum', async () => {
|
|
1050
1081
|
const schema = {
|
|
1051
1082
|
type: 'object',
|
|
1052
1083
|
properties: {
|
|
@@ -1056,10 +1087,8 @@ export function formTests(Form, customOptions = {}) {
|
|
|
1056
1087
|
},
|
|
1057
1088
|
},
|
|
1058
1089
|
};
|
|
1059
|
-
const
|
|
1060
|
-
|
|
1061
|
-
.toJSON();
|
|
1062
|
-
expect(tree).toMatchSnapshot();
|
|
1090
|
+
const { asFragment } = render(_jsx(Form, { schema: schema, validator: validator, nameGenerator: dotNotationNameGenerator }));
|
|
1091
|
+
expect(asFragment()).toMatchSnapshot();
|
|
1063
1092
|
});
|
|
1064
1093
|
});
|
|
1065
1094
|
});
|