@truedat/df 4.28.1 → 4.28.5

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.
@@ -0,0 +1,97 @@
1
+ import React from "react";
2
+ import { waitFor } from "@testing-library/react";
3
+ import userEvent from "@testing-library/user-event";
4
+ import { render } from "@truedat/test/render";
5
+ import { MandatoryConditional } from "../MandatoryConditional";
6
+
7
+ describe("<MandatoryConditional />", () => {
8
+ const onChange = jest.fn();
9
+ const fieldNamePrefix = "fields[0].name";
10
+ const allFields = [
11
+ {
12
+ name: "foo",
13
+ label: "Foo",
14
+ type: "string",
15
+ cardinality: "+",
16
+ values: { fixed: ["1", "2"] },
17
+ },
18
+ {
19
+ name: "bar",
20
+ label: "Bar",
21
+ type: "string",
22
+ cardinality: "?",
23
+ values: { fixed: ["3", "4"] },
24
+ },
25
+ {
26
+ name: "xyz",
27
+ label: "Xyz",
28
+ type: "string",
29
+ cardinality: "?",
30
+ },
31
+ {
32
+ name: "name",
33
+ label: "Name",
34
+ type: "string",
35
+ cardinality: "?",
36
+ },
37
+ ];
38
+ const renderOpts = {
39
+ messages: {
40
+ en: {
41
+ "template.field.mandatory.depends": "depends",
42
+ "template.field.mandatory.depends.on": "on",
43
+ "template.field.mandatory.depends.to_be": "to be",
44
+ },
45
+ },
46
+ };
47
+
48
+ const field = {
49
+ name: "name",
50
+ label: "Name",
51
+ mandatory: { on: "bar", to_be: ["3"] },
52
+ };
53
+ const props = { allFields, field, fieldNamePrefix, onChange };
54
+
55
+ it("matches the latest snapshot", () => {
56
+ const { container } = render(
57
+ <MandatoryConditional {...props} />,
58
+ renderOpts
59
+ );
60
+ expect(container).toMatchSnapshot();
61
+ });
62
+
63
+ it("calls onChange when whe select a field", async () => {
64
+ const { findByRole } = render(
65
+ <MandatoryConditional {...props} />,
66
+ renderOpts
67
+ );
68
+
69
+ userEvent.click(await findByRole("option", { name: /Foo/ }));
70
+ await waitFor(() => {
71
+ expect(onChange.mock.calls[0][1]).toEqual({
72
+ name: `${fieldNamePrefix}.mandatory.to_be`,
73
+ value: [],
74
+ });
75
+ expect(onChange.mock.calls[1][1]).toEqual({
76
+ name: `${fieldNamePrefix}.mandatory.on`,
77
+ value: "foo",
78
+ });
79
+ });
80
+ });
81
+
82
+ it("calls onChange when whe select a value to a field", async () => {
83
+ onChange.mockClear();
84
+ const { findByRole } = render(
85
+ <MandatoryConditional {...props} />,
86
+ renderOpts
87
+ );
88
+
89
+ userEvent.click(await findByRole("option", { name: /4/ }));
90
+ await waitFor(() => {
91
+ expect(onChange.mock.calls[0][1]).toEqual({
92
+ name: `${fieldNamePrefix}.mandatory.to_be`,
93
+ value: ["3", "4"],
94
+ });
95
+ });
96
+ });
97
+ });
@@ -0,0 +1,121 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<DependentFormField /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ class="field"
7
+ >
8
+ <label>
9
+ label
10
+ </label>
11
+ <div
12
+ class="equal width fields"
13
+ >
14
+ <div
15
+ class="field"
16
+ >
17
+ <div
18
+ class="field"
19
+ >
20
+ <div
21
+ aria-disabled="false"
22
+ aria-expanded="false"
23
+ class="ui fluid search selection dropdown"
24
+ name="field"
25
+ role="combobox"
26
+ >
27
+ <input
28
+ aria-autocomplete="list"
29
+ autocomplete="off"
30
+ class="search"
31
+ tabindex="0"
32
+ type="text"
33
+ value=""
34
+ />
35
+ <div
36
+ aria-atomic="true"
37
+ aria-live="polite"
38
+ class="divider text"
39
+ role="alert"
40
+ >
41
+ bar
42
+ </div>
43
+ <i
44
+ aria-hidden="true"
45
+ class="dropdown icon clear"
46
+ />
47
+ <div
48
+ class="menu transition"
49
+ role="listbox"
50
+ >
51
+ <div
52
+ aria-checked="true"
53
+ aria-selected="true"
54
+ class="active selected item"
55
+ role="option"
56
+ style="pointer-events: all;"
57
+ >
58
+ <span
59
+ class="text"
60
+ >
61
+ bar
62
+ </span>
63
+ </div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ <div
69
+ class="field"
70
+ >
71
+ <div
72
+ class="field"
73
+ >
74
+ <div
75
+ aria-disabled="false"
76
+ aria-expanded="false"
77
+ class="ui fluid multiple search selection dropdown"
78
+ name="value"
79
+ role="combobox"
80
+ >
81
+ <input
82
+ aria-autocomplete="list"
83
+ autocomplete="off"
84
+ class="search"
85
+ tabindex="0"
86
+ type="text"
87
+ value=""
88
+ />
89
+ <span
90
+ class="sizer"
91
+ />
92
+ <div
93
+ aria-atomic="true"
94
+ aria-live="polite"
95
+ class="divider text"
96
+ role="alert"
97
+ >
98
+ foo
99
+ </div>
100
+ <i
101
+ aria-hidden="true"
102
+ class="dropdown icon clear"
103
+ />
104
+ <div
105
+ aria-multiselectable="true"
106
+ class="menu transition"
107
+ role="listbox"
108
+ >
109
+ <div
110
+ class="message"
111
+ >
112
+ No results found.
113
+ </div>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ `;
@@ -1,5 +1,346 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`<FieldForm /> manages handleCardinalityChange 1`] = `
4
+ <Segment>
5
+ <ButtonGroup
6
+ basic={true}
7
+ buttons={
8
+ Array [
9
+ Object {
10
+ "disabled": true,
11
+ "icon": "arrow up",
12
+ "key": "up",
13
+ "onClick": [Function],
14
+ },
15
+ Object {
16
+ "disabled": true,
17
+ "icon": "arrow down",
18
+ "key": "down",
19
+ "onClick": [Function],
20
+ },
21
+ Object {
22
+ "disabled": false,
23
+ "icon": "trash alternate outline",
24
+ "key": "delete",
25
+ "onClick": [MockFunction],
26
+ },
27
+ ]
28
+ }
29
+ color="orange"
30
+ floated="right"
31
+ size="tiny"
32
+ />
33
+ <Divider
34
+ clearing={true}
35
+ hidden={true}
36
+ />
37
+ <FormGroup
38
+ size="small"
39
+ widths="equal"
40
+ >
41
+ <FormInput
42
+ as={[Function]}
43
+ control={[Function]}
44
+ label="template.field.label"
45
+ name="Group.fields[0].label"
46
+ onChange={[MockFunction]}
47
+ required={true}
48
+ size="small"
49
+ value="Name"
50
+ />
51
+ <FormInput
52
+ as={[Function]}
53
+ control={[Function]}
54
+ disabled={false}
55
+ fluid={true}
56
+ label="template.field.name"
57
+ name="Group.fields[0].name"
58
+ onChange={[MockFunction]}
59
+ required={true}
60
+ size="small"
61
+ value="name"
62
+ />
63
+ </FormGroup>
64
+ <FormTextArea
65
+ as={[Function]}
66
+ control={[Function]}
67
+ label="template.field.description"
68
+ name="Group.fields[0].description"
69
+ onChange={[MockFunction]}
70
+ rows={4}
71
+ size="small"
72
+ value=""
73
+ />
74
+ <FormGroup
75
+ size="small"
76
+ widths="equal"
77
+ >
78
+ <FormDropdown
79
+ as={[Function]}
80
+ control={[Function]}
81
+ fluid={true}
82
+ label="template.field.widget"
83
+ name="Group.fields[0].widget"
84
+ onChange={[Function]}
85
+ options={
86
+ Array [
87
+ Object {
88
+ "icon": "minus",
89
+ "key": undefined,
90
+ "text": "Text Input",
91
+ "value": "string",
92
+ },
93
+ Object {
94
+ "icon": "align justify",
95
+ "key": undefined,
96
+ "text": "Textarea",
97
+ "value": "textarea",
98
+ },
99
+ Object {
100
+ "icon": "arrow down",
101
+ "key": undefined,
102
+ "text": "Dropdown",
103
+ "value": "dropdown",
104
+ },
105
+ Object {
106
+ "icon": "radio",
107
+ "key": undefined,
108
+ "text": "Radio",
109
+ "value": "radio",
110
+ },
111
+ Object {
112
+ "icon": "check square outline",
113
+ "key": undefined,
114
+ "text": "Checkbox",
115
+ "value": "checkbox",
116
+ },
117
+ Object {
118
+ "icon": "linkify",
119
+ "key": undefined,
120
+ "text": "Links",
121
+ "value": "pair_list",
122
+ },
123
+ Object {
124
+ "icon": "tint",
125
+ "key": undefined,
126
+ "text": "Colorpicker",
127
+ "value": "color_picker",
128
+ },
129
+ Object {
130
+ "icon": "text cursor",
131
+ "key": undefined,
132
+ "text": "Enrichedtext",
133
+ "value": "enriched_text",
134
+ },
135
+ Object {
136
+ "icon": "table",
137
+ "key": undefined,
138
+ "text": "Table",
139
+ "value": "table",
140
+ },
141
+ Object {
142
+ "icon": "asterisk",
143
+ "key": undefined,
144
+ "text": "Password",
145
+ "value": "password",
146
+ },
147
+ Object {
148
+ "icon": "image",
149
+ "key": undefined,
150
+ "text": "Image",
151
+ "value": "image",
152
+ },
153
+ Object {
154
+ "icon": "hashtag",
155
+ "key": undefined,
156
+ "text": "Number",
157
+ "value": "number",
158
+ },
159
+ Object {
160
+ "icon": "calendar",
161
+ "key": undefined,
162
+ "text": "Date",
163
+ "value": "date",
164
+ },
165
+ Object {
166
+ "icon": "calendar",
167
+ "key": undefined,
168
+ "text": "Date Time",
169
+ "value": "datetime",
170
+ },
171
+ Object {
172
+ "icon": "file alternate outline",
173
+ "key": undefined,
174
+ "text": "File Structure",
175
+ "value": "copy",
176
+ },
177
+ ]
178
+ }
179
+ required={true}
180
+ selection={true}
181
+ />
182
+ <FormDropdown
183
+ as={[Function]}
184
+ control={[Function]}
185
+ fluid={true}
186
+ label="template.field.type"
187
+ name="Group.fields[0].type"
188
+ onChange={[Function]}
189
+ options={Array []}
190
+ required={true}
191
+ selection={true}
192
+ />
193
+ <FormDropdown
194
+ as={[Function]}
195
+ control={[Function]}
196
+ fluid={true}
197
+ label="template.field.cardinality"
198
+ name="Group.fields[0].cardinality"
199
+ onChange={[Function]}
200
+ options={Array []}
201
+ required={true}
202
+ selection={true}
203
+ value="?"
204
+ />
205
+ </FormGroup>
206
+ <ValuesField
207
+ defaultField="Group.fields[0].default"
208
+ field={
209
+ Object {
210
+ "cardinality": "?",
211
+ "label": "Name",
212
+ "mandatory": Object {
213
+ "on": "bar",
214
+ "to_be": Array [
215
+ "3",
216
+ ],
217
+ },
218
+ "name": "name",
219
+ }
220
+ }
221
+ name="Group.fields[0].values"
222
+ onChange={[MockFunction]}
223
+ onSelectionChange={[Function]}
224
+ subscribableField="Group.fields[0].subscribable"
225
+ values={Array []}
226
+ />
227
+ <ConditionalFieldForm
228
+ allFields={
229
+ Array [
230
+ Object {
231
+ "cardinality": "+",
232
+ "label": "Foo",
233
+ "name": "foo",
234
+ "type": "string",
235
+ "values": Object {
236
+ "fixed": Array [
237
+ "1",
238
+ "2",
239
+ ],
240
+ },
241
+ },
242
+ Object {
243
+ "cardinality": "?",
244
+ "label": "Bar",
245
+ "name": "bar",
246
+ "type": "string",
247
+ "values": Object {
248
+ "fixed": Array [
249
+ "3",
250
+ "4",
251
+ ],
252
+ },
253
+ },
254
+ Object {
255
+ "cardinality": "?",
256
+ "label": "Xyz",
257
+ "name": "xyz",
258
+ "type": "string",
259
+ },
260
+ Object {
261
+ "cardinality": "?",
262
+ "label": "Name",
263
+ "name": "name",
264
+ "type": "string",
265
+ },
266
+ ]
267
+ }
268
+ field={
269
+ Object {
270
+ "cardinality": "?",
271
+ "label": "Name",
272
+ "mandatory": Object {
273
+ "on": "bar",
274
+ "to_be": Array [
275
+ "3",
276
+ ],
277
+ },
278
+ "name": "name",
279
+ }
280
+ }
281
+ fieldNamePrefix="Group.fields[0]"
282
+ onChange={[MockFunction]}
283
+ />
284
+ <MandatoryConditional
285
+ allFields={
286
+ Array [
287
+ Object {
288
+ "cardinality": "+",
289
+ "label": "Foo",
290
+ "name": "foo",
291
+ "type": "string",
292
+ "values": Object {
293
+ "fixed": Array [
294
+ "1",
295
+ "2",
296
+ ],
297
+ },
298
+ },
299
+ Object {
300
+ "cardinality": "?",
301
+ "label": "Bar",
302
+ "name": "bar",
303
+ "type": "string",
304
+ "values": Object {
305
+ "fixed": Array [
306
+ "3",
307
+ "4",
308
+ ],
309
+ },
310
+ },
311
+ Object {
312
+ "cardinality": "?",
313
+ "label": "Xyz",
314
+ "name": "xyz",
315
+ "type": "string",
316
+ },
317
+ Object {
318
+ "cardinality": "?",
319
+ "label": "Name",
320
+ "name": "name",
321
+ "type": "string",
322
+ },
323
+ ]
324
+ }
325
+ field={
326
+ Object {
327
+ "cardinality": "?",
328
+ "label": "Name",
329
+ "mandatory": Object {
330
+ "on": "bar",
331
+ "to_be": Array [
332
+ "3",
333
+ ],
334
+ },
335
+ "name": "name",
336
+ }
337
+ }
338
+ fieldNamePrefix="Group.fields[0]"
339
+ onChange={[MockFunction]}
340
+ />
341
+ </Segment>
342
+ `;
343
+
3
344
  exports[`<FieldForm /> matches the latest snapshot 1`] = `
4
345
  <Segment>
5
346
  <ButtonGroup
@@ -42,11 +383,297 @@ exports[`<FieldForm /> matches the latest snapshot 1`] = `
42
383
  as={[Function]}
43
384
  control={[Function]}
44
385
  label="template.field.label"
45
- name="undefined.fields[0].label"
386
+ name="undefined.fields[0].label"
387
+ onChange={[MockFunction]}
388
+ required={true}
389
+ size="small"
390
+ value="Field 1"
391
+ />
392
+ <FormInput
393
+ as={[Function]}
394
+ control={[Function]}
395
+ disabled={false}
396
+ fluid={true}
397
+ label="template.field.name"
398
+ name="undefined.fields[0].name"
399
+ onChange={[MockFunction]}
400
+ required={true}
401
+ size="small"
402
+ value="field1"
403
+ />
404
+ </FormGroup>
405
+ <FormTextArea
406
+ as={[Function]}
407
+ control={[Function]}
408
+ label="template.field.description"
409
+ name="undefined.fields[0].description"
410
+ onChange={[MockFunction]}
411
+ rows={4}
412
+ size="small"
413
+ value="A field for testing"
414
+ />
415
+ <FormGroup
416
+ size="small"
417
+ widths="equal"
418
+ >
419
+ <FormDropdown
420
+ as={[Function]}
421
+ control={[Function]}
422
+ fluid={true}
423
+ label="template.field.widget"
424
+ name="undefined.fields[0].widget"
425
+ onChange={[Function]}
426
+ options={
427
+ Array [
428
+ Object {
429
+ "icon": "minus",
430
+ "key": undefined,
431
+ "text": "Text Input",
432
+ "value": "string",
433
+ },
434
+ Object {
435
+ "icon": "align justify",
436
+ "key": undefined,
437
+ "text": "Textarea",
438
+ "value": "textarea",
439
+ },
440
+ Object {
441
+ "icon": "arrow down",
442
+ "key": undefined,
443
+ "text": "Dropdown",
444
+ "value": "dropdown",
445
+ },
446
+ Object {
447
+ "icon": "radio",
448
+ "key": undefined,
449
+ "text": "Radio",
450
+ "value": "radio",
451
+ },
452
+ Object {
453
+ "icon": "check square outline",
454
+ "key": undefined,
455
+ "text": "Checkbox",
456
+ "value": "checkbox",
457
+ },
458
+ Object {
459
+ "icon": "linkify",
460
+ "key": undefined,
461
+ "text": "Links",
462
+ "value": "pair_list",
463
+ },
464
+ Object {
465
+ "icon": "tint",
466
+ "key": undefined,
467
+ "text": "Colorpicker",
468
+ "value": "color_picker",
469
+ },
470
+ Object {
471
+ "icon": "text cursor",
472
+ "key": undefined,
473
+ "text": "Enrichedtext",
474
+ "value": "enriched_text",
475
+ },
476
+ Object {
477
+ "icon": "table",
478
+ "key": undefined,
479
+ "text": "Table",
480
+ "value": "table",
481
+ },
482
+ Object {
483
+ "icon": "asterisk",
484
+ "key": undefined,
485
+ "text": "Password",
486
+ "value": "password",
487
+ },
488
+ Object {
489
+ "icon": "image",
490
+ "key": undefined,
491
+ "text": "Image",
492
+ "value": "image",
493
+ },
494
+ Object {
495
+ "icon": "hashtag",
496
+ "key": undefined,
497
+ "text": "Number",
498
+ "value": "number",
499
+ },
500
+ Object {
501
+ "icon": "calendar",
502
+ "key": undefined,
503
+ "text": "Date",
504
+ "value": "date",
505
+ },
506
+ Object {
507
+ "icon": "calendar",
508
+ "key": undefined,
509
+ "text": "Date Time",
510
+ "value": "datetime",
511
+ },
512
+ Object {
513
+ "icon": "file alternate outline",
514
+ "key": undefined,
515
+ "text": "File Structure",
516
+ "value": "copy",
517
+ },
518
+ ]
519
+ }
520
+ required={true}
521
+ selection={true}
522
+ value="string"
523
+ />
524
+ <FormDropdown
525
+ as={[Function]}
526
+ control={[Function]}
527
+ fluid={true}
528
+ label="template.field.type"
529
+ name="undefined.fields[0].type"
530
+ onChange={[Function]}
531
+ options={
532
+ Array [
533
+ Object {
534
+ "key": "string",
535
+ "text": "template.field.type.string",
536
+ "value": "string",
537
+ },
538
+ ]
539
+ }
540
+ required={true}
541
+ selection={true}
542
+ value="list"
543
+ />
544
+ <FormDropdown
545
+ as={[Function]}
546
+ control={[Function]}
547
+ fluid={true}
548
+ label="template.field.cardinality"
549
+ name="undefined.fields[0].cardinality"
550
+ onChange={[Function]}
551
+ options={
552
+ Array [
553
+ Object {
554
+ "key": "?",
555
+ "text": "template.field.cardinality.?",
556
+ "value": "?",
557
+ },
558
+ Object {
559
+ "key": "1",
560
+ "text": "template.field.cardinality.1",
561
+ "value": "1",
562
+ },
563
+ Object {
564
+ "key": "*",
565
+ "text": "template.field.cardinality.*",
566
+ "value": "*",
567
+ },
568
+ Object {
569
+ "key": "+",
570
+ "text": "template.field.cardinality.+",
571
+ "value": "+",
572
+ },
573
+ ]
574
+ }
575
+ required={true}
576
+ selection={true}
577
+ />
578
+ </FormGroup>
579
+ <ValuesField
580
+ defaultField="undefined.fields[0].default"
581
+ field={
582
+ Object {
583
+ "description": "A field for testing",
584
+ "label": "Field 1",
585
+ "meta": Object {
586
+ "role": "Data Owner",
587
+ },
588
+ "name": "field1",
589
+ "required": true,
590
+ "type": "list",
591
+ "values": Array [
592
+ "V1",
593
+ "V2",
594
+ ],
595
+ "widget": "string",
596
+ }
597
+ }
598
+ fieldType="list"
599
+ keyType="0"
600
+ name="undefined.fields[0].values"
601
+ onChange={[MockFunction]}
602
+ onSelectionChange={[Function]}
603
+ subscribableField="undefined.fields[0].subscribable"
604
+ values={Array []}
605
+ />
606
+ <ConditionalFieldForm
607
+ field={
608
+ Object {
609
+ "description": "A field for testing",
610
+ "label": "Field 1",
611
+ "meta": Object {
612
+ "role": "Data Owner",
613
+ },
614
+ "name": "field1",
615
+ "required": true,
616
+ "type": "list",
617
+ "values": Array [
618
+ "V1",
619
+ "V2",
620
+ ],
621
+ "widget": "string",
622
+ }
623
+ }
624
+ fieldNamePrefix="undefined.fields[0]"
625
+ onChange={[MockFunction]}
626
+ />
627
+ </Segment>
628
+ `;
629
+
630
+ exports[`<FieldForm /> renders MandatoryConditional 1`] = `
631
+ <Segment>
632
+ <ButtonGroup
633
+ basic={true}
634
+ buttons={
635
+ Array [
636
+ Object {
637
+ "disabled": true,
638
+ "icon": "arrow up",
639
+ "key": "up",
640
+ "onClick": [Function],
641
+ },
642
+ Object {
643
+ "disabled": true,
644
+ "icon": "arrow down",
645
+ "key": "down",
646
+ "onClick": [Function],
647
+ },
648
+ Object {
649
+ "disabled": false,
650
+ "icon": "trash alternate outline",
651
+ "key": "delete",
652
+ "onClick": [MockFunction],
653
+ },
654
+ ]
655
+ }
656
+ color="orange"
657
+ floated="right"
658
+ size="tiny"
659
+ />
660
+ <Divider
661
+ clearing={true}
662
+ hidden={true}
663
+ />
664
+ <FormGroup
665
+ size="small"
666
+ widths="equal"
667
+ >
668
+ <FormInput
669
+ as={[Function]}
670
+ control={[Function]}
671
+ label="template.field.label"
672
+ name="Group.fields[0].label"
46
673
  onChange={[MockFunction]}
47
674
  required={true}
48
675
  size="small"
49
- value="Field 1"
676
+ value="Name"
50
677
  />
51
678
  <FormInput
52
679
  as={[Function]}
@@ -54,22 +681,22 @@ exports[`<FieldForm /> matches the latest snapshot 1`] = `
54
681
  disabled={false}
55
682
  fluid={true}
56
683
  label="template.field.name"
57
- name="undefined.fields[0].name"
684
+ name="Group.fields[0].name"
58
685
  onChange={[MockFunction]}
59
686
  required={true}
60
687
  size="small"
61
- value="field1"
688
+ value="name"
62
689
  />
63
690
  </FormGroup>
64
691
  <FormTextArea
65
692
  as={[Function]}
66
693
  control={[Function]}
67
694
  label="template.field.description"
68
- name="undefined.fields[0].description"
695
+ name="Group.fields[0].description"
69
696
  onChange={[MockFunction]}
70
697
  rows={4}
71
698
  size="small"
72
- value="A field for testing"
699
+ value=""
73
700
  />
74
701
  <FormGroup
75
702
  size="small"
@@ -80,7 +707,7 @@ exports[`<FieldForm /> matches the latest snapshot 1`] = `
80
707
  control={[Function]}
81
708
  fluid={true}
82
709
  label="template.field.widget"
83
- name="undefined.fields[0].widget"
710
+ name="Group.fields[0].widget"
84
711
  onChange={[Function]}
85
712
  options={
86
713
  Array [
@@ -178,109 +805,164 @@ exports[`<FieldForm /> matches the latest snapshot 1`] = `
178
805
  }
179
806
  required={true}
180
807
  selection={true}
181
- value="string"
182
808
  />
183
809
  <FormDropdown
184
810
  as={[Function]}
185
811
  control={[Function]}
186
812
  fluid={true}
187
813
  label="template.field.type"
188
- name="undefined.fields[0].type"
814
+ name="Group.fields[0].type"
189
815
  onChange={[Function]}
190
- options={
191
- Array [
192
- Object {
193
- "key": "string",
194
- "text": "template.field.type.string",
195
- "value": "string",
196
- },
197
- ]
198
- }
816
+ options={Array []}
199
817
  required={true}
200
818
  selection={true}
201
- value="list"
202
819
  />
203
820
  <FormDropdown
204
821
  as={[Function]}
205
822
  control={[Function]}
206
823
  fluid={true}
207
824
  label="template.field.cardinality"
208
- name="undefined.fields[0].cardinality"
209
- onChange={[MockFunction]}
210
- options={
211
- Array [
212
- Object {
213
- "key": "?",
214
- "text": "template.field.cardinality.?",
215
- "value": "?",
216
- },
217
- Object {
218
- "key": "1",
219
- "text": "template.field.cardinality.1",
220
- "value": "1",
221
- },
222
- Object {
223
- "key": "*",
224
- "text": "template.field.cardinality.*",
225
- "value": "*",
226
- },
227
- Object {
228
- "key": "+",
229
- "text": "template.field.cardinality.+",
230
- "value": "+",
231
- },
232
- ]
233
- }
825
+ name="Group.fields[0].cardinality"
826
+ onChange={[Function]}
827
+ options={Array []}
234
828
  required={true}
235
829
  selection={true}
830
+ value="?"
236
831
  />
237
832
  </FormGroup>
238
833
  <ValuesField
239
- defaultField="undefined.fields[0].default"
834
+ defaultField="Group.fields[0].default"
240
835
  field={
241
836
  Object {
242
- "description": "A field for testing",
243
- "label": "Field 1",
244
- "meta": Object {
245
- "role": "Data Owner",
837
+ "cardinality": "?",
838
+ "label": "Name",
839
+ "mandatory": Object {
840
+ "on": "bar",
841
+ "to_be": Array [
842
+ "3",
843
+ ],
246
844
  },
247
- "name": "field1",
248
- "required": true,
249
- "type": "list",
250
- "values": Array [
251
- "V1",
252
- "V2",
253
- ],
254
- "widget": "string",
845
+ "name": "name",
255
846
  }
256
847
  }
257
- fieldType="list"
258
- keyType="0"
259
- name="undefined.fields[0].values"
848
+ name="Group.fields[0].values"
260
849
  onChange={[MockFunction]}
261
850
  onSelectionChange={[Function]}
262
- subscribableField="undefined.fields[0].subscribable"
851
+ subscribableField="Group.fields[0].subscribable"
263
852
  values={Array []}
264
853
  />
265
854
  <ConditionalFieldForm
855
+ allFields={
856
+ Array [
857
+ Object {
858
+ "cardinality": "+",
859
+ "label": "Foo",
860
+ "name": "foo",
861
+ "type": "string",
862
+ "values": Object {
863
+ "fixed": Array [
864
+ "1",
865
+ "2",
866
+ ],
867
+ },
868
+ },
869
+ Object {
870
+ "cardinality": "?",
871
+ "label": "Bar",
872
+ "name": "bar",
873
+ "type": "string",
874
+ "values": Object {
875
+ "fixed": Array [
876
+ "3",
877
+ "4",
878
+ ],
879
+ },
880
+ },
881
+ Object {
882
+ "cardinality": "?",
883
+ "label": "Xyz",
884
+ "name": "xyz",
885
+ "type": "string",
886
+ },
887
+ Object {
888
+ "cardinality": "?",
889
+ "label": "Name",
890
+ "name": "name",
891
+ "type": "string",
892
+ },
893
+ ]
894
+ }
266
895
  field={
267
896
  Object {
268
- "description": "A field for testing",
269
- "label": "Field 1",
270
- "meta": Object {
271
- "role": "Data Owner",
897
+ "cardinality": "?",
898
+ "label": "Name",
899
+ "mandatory": Object {
900
+ "on": "bar",
901
+ "to_be": Array [
902
+ "3",
903
+ ],
272
904
  },
273
- "name": "field1",
274
- "required": true,
275
- "type": "list",
276
- "values": Array [
277
- "V1",
278
- "V2",
279
- ],
280
- "widget": "string",
905
+ "name": "name",
281
906
  }
282
907
  }
283
- fieldNamePrefix="undefined.fields[0]"
908
+ fieldNamePrefix="Group.fields[0]"
909
+ onChange={[MockFunction]}
910
+ />
911
+ <MandatoryConditional
912
+ allFields={
913
+ Array [
914
+ Object {
915
+ "cardinality": "+",
916
+ "label": "Foo",
917
+ "name": "foo",
918
+ "type": "string",
919
+ "values": Object {
920
+ "fixed": Array [
921
+ "1",
922
+ "2",
923
+ ],
924
+ },
925
+ },
926
+ Object {
927
+ "cardinality": "?",
928
+ "label": "Bar",
929
+ "name": "bar",
930
+ "type": "string",
931
+ "values": Object {
932
+ "fixed": Array [
933
+ "3",
934
+ "4",
935
+ ],
936
+ },
937
+ },
938
+ Object {
939
+ "cardinality": "?",
940
+ "label": "Xyz",
941
+ "name": "xyz",
942
+ "type": "string",
943
+ },
944
+ Object {
945
+ "cardinality": "?",
946
+ "label": "Name",
947
+ "name": "name",
948
+ "type": "string",
949
+ },
950
+ ]
951
+ }
952
+ field={
953
+ Object {
954
+ "cardinality": "?",
955
+ "label": "Name",
956
+ "mandatory": Object {
957
+ "on": "bar",
958
+ "to_be": Array [
959
+ "3",
960
+ ],
961
+ },
962
+ "name": "name",
963
+ }
964
+ }
965
+ fieldNamePrefix="Group.fields[0]"
284
966
  onChange={[MockFunction]}
285
967
  />
286
968
  </Segment>
@@ -507,7 +1189,7 @@ exports[`<FieldForm /> renders ValuesField and manages onChange 1`] = `
507
1189
  fluid={true}
508
1190
  label="template.field.cardinality"
509
1191
  name="Group.fields[0].cardinality"
510
- onChange={[MockFunction]}
1192
+ onChange={[Function]}
511
1193
  options={
512
1194
  Array [
513
1195
  Object {