@worksafevictoria/wcl7.5 1.1.11 → 1.1.12

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.
Files changed (203) hide show
  1. package/jest.config.js +9 -7
  2. package/package.json +6 -5
  3. package/src/components/Paragraphs/Directory/Records/CJ/index.vue +3 -3
  4. package/src/components/Paragraphs/Directory/Records/ISP/index.vue +3 -3
  5. package/src/components/Paragraphs/Directory/Records/PRS/index.vue +2 -2
  6. package/src/components/Paragraphs/Directory/Records/PRS/recordContent.vue +3 -3
  7. package/src/components/Paragraphs/Directory/Records/PRS/recordDetails.vue +3 -3
  8. package/src/components/Paragraphs/Directory/Records/index.vue +3 -3
  9. package/src/components/Paragraphs/Directory/index.vue +4 -4
  10. package/src/components/Paragraphs/Webform/index.stories.js +30 -29
  11. package/src/components/Paragraphs/Webform/index.vue +10 -7
  12. package/src/components/SubComponents/FormInstance/components/alert/index.vue +129 -0
  13. package/src/components/SubComponents/FormInstance/components/custom/base-formio.js +77 -0
  14. package/src/components/SubComponents/FormInstance/components/custom/code-formio.js +35 -0
  15. package/src/components/SubComponents/FormInstance/components/custom/custom-formio-registry.js +30 -0
  16. package/src/components/SubComponents/FormInstance/components/custom/range-formio.js +121 -0
  17. package/src/components/SubComponents/FormInstance/components/custom/rating-formio.js +121 -0
  18. package/src/components/SubComponents/FormInstance/components/custom/scale-formio.js +99 -0
  19. package/src/components/SubComponents/FormInstance/components/custom/tableselect-formio.js +200 -0
  20. package/src/components/SubComponents/FormInstance/components/handler/index.vue +208 -0
  21. package/src/components/SubComponents/FormInstance/components/renderer/index.vue +282 -0
  22. package/src/components/SubComponents/FormInstance/index.test.js +65 -0
  23. package/src/components/SubComponents/FormInstance/index.vue +55 -6
  24. package/src/components/SubComponents/FormInstance/models/base-form-element.js +338 -0
  25. package/src/components/SubComponents/FormInstance/models/form-callback-queue.js +45 -0
  26. package/src/components/SubComponents/FormInstance/models/form-utils.js +50 -0
  27. package/src/components/SubComponents/FormInstance/models/overrides/address.js +132 -0
  28. package/src/components/SubComponents/FormInstance/models/overrides/autocomplete.js +41 -0
  29. package/src/components/SubComponents/FormInstance/models/overrides/checkbox.js +14 -0
  30. package/src/components/SubComponents/FormInstance/models/overrides/checkboxes.js +49 -0
  31. package/src/components/SubComponents/FormInstance/models/overrides/code.js +27 -0
  32. package/src/components/SubComponents/FormInstance/models/overrides/composite.js +57 -0
  33. package/src/components/SubComponents/FormInstance/models/overrides/container.js +65 -0
  34. package/src/components/SubComponents/FormInstance/models/overrides/currency.js +17 -0
  35. package/src/components/SubComponents/FormInstance/models/overrides/customcomposite.js +41 -0
  36. package/src/components/SubComponents/FormInstance/models/overrides/date.js +126 -0
  37. package/src/components/SubComponents/FormInstance/models/overrides/datelist.js +73 -0
  38. package/src/components/SubComponents/FormInstance/models/overrides/detail.js +38 -0
  39. package/src/components/SubComponents/FormInstance/models/overrides/email-confirm.js +12 -0
  40. package/src/components/SubComponents/FormInstance/models/overrides/email.js +7 -0
  41. package/src/components/SubComponents/FormInstance/models/overrides/file.js +56 -0
  42. package/src/components/SubComponents/FormInstance/models/overrides/flexbox.js +33 -0
  43. package/src/components/SubComponents/FormInstance/models/overrides/hidden.js +24 -0
  44. package/src/components/SubComponents/FormInstance/models/overrides/likert.js +40 -0
  45. package/src/components/SubComponents/FormInstance/models/overrides/markup.js +47 -0
  46. package/src/components/SubComponents/FormInstance/models/overrides/message.js +53 -0
  47. package/src/components/SubComponents/FormInstance/models/overrides/moretext.js +64 -0
  48. package/src/components/SubComponents/FormInstance/models/overrides/multiple.js +51 -0
  49. package/src/components/SubComponents/FormInstance/models/overrides/number.js +22 -0
  50. package/src/components/SubComponents/FormInstance/models/overrides/options-other.js +34 -0
  51. package/src/components/SubComponents/FormInstance/models/overrides/page.js +7 -0
  52. package/src/components/SubComponents/FormInstance/models/overrides/phonenumber.js +13 -0
  53. package/src/components/SubComponents/FormInstance/models/overrides/radio.js +31 -0
  54. package/src/components/SubComponents/FormInstance/models/overrides/range.js +19 -0
  55. package/src/components/SubComponents/FormInstance/models/overrides/rating.js +47 -0
  56. package/src/components/SubComponents/FormInstance/models/overrides/scale.js +33 -0
  57. package/src/components/SubComponents/FormInstance/models/overrides/section.js +39 -0
  58. package/src/components/SubComponents/FormInstance/models/overrides/select.js +28 -0
  59. package/src/components/SubComponents/FormInstance/models/overrides/signature.js +7 -0
  60. package/src/components/SubComponents/FormInstance/models/overrides/submit.js +23 -0
  61. package/src/components/SubComponents/FormInstance/models/overrides/table.js +48 -0
  62. package/src/components/SubComponents/FormInstance/models/overrides/tablerow.js +20 -0
  63. package/src/components/SubComponents/FormInstance/models/overrides/tableselect.js +66 -0
  64. package/src/components/SubComponents/FormInstance/models/overrides/testing.js +47 -0
  65. package/src/components/SubComponents/FormInstance/models/overrides/text.js +7 -0
  66. package/src/components/SubComponents/FormInstance/models/overrides/textarea.js +26 -0
  67. package/src/components/SubComponents/FormInstance/models/overrides/textformat.js +13 -0
  68. package/src/components/SubComponents/FormInstance/models/overrides/time.js +13 -0
  69. package/src/components/SubComponents/FormInstance/models/overrides/twig.js +118 -0
  70. package/src/components/SubComponents/FormInstance/models/overrides/unknown.js +24 -0
  71. package/src/components/SubComponents/FormInstance/models/overrides/url.js +13 -0
  72. package/src/components/SubComponents/FormInstance/services/convert-form-element.js +49 -0
  73. package/src/components/SubComponents/FormInstance/services/form-api.js +47 -0
  74. package/src/components/SubComponents/FormInstance/services/form-render-parser.js +156 -0
  75. package/src/components/SubComponents/FormInstance/services/form-submit-parser.js +61 -0
  76. package/src/components/SubComponents/FormInstance/services/logic-linker.js +73 -0
  77. package/src/components/SubComponents/FormInstance/services/logic-parser.js +173 -0
  78. package/src/components/SubComponents/FormInstance/services/registry-factory.js +284 -0
  79. package/src/components/SubComponents/FormInstance/stories/Documentation.mdx +234 -0
  80. package/src/components/SubComponents/FormInstance/stories/advanced.stories.js +109 -0
  81. package/src/components/SubComponents/FormInstance/stories/basic.stories.js +73 -0
  82. package/src/components/SubComponents/FormInstance/stories/build.stories.js +27 -0
  83. package/src/components/SubComponents/FormInstance/stories/composite.stories.js +90 -0
  84. package/src/components/SubComponents/FormInstance/stories/condition.stories.js +83 -0
  85. package/src/components/SubComponents/FormInstance/stories/custom.stories.js +69 -0
  86. package/src/components/SubComponents/FormInstance/stories/date.stories.js +76 -0
  87. package/src/components/SubComponents/FormInstance/stories/form-alert.stories.js +93 -0
  88. package/src/components/SubComponents/FormInstance/stories/index.stories.js +63 -0
  89. package/src/components/SubComponents/FormInstance/stories/layout.stories.js +85 -0
  90. package/src/components/SubComponents/FormInstance/stories/markup.stories.js +91 -0
  91. package/src/components/SubComponents/FormInstance/stories/mocks/address.json +298 -0
  92. package/src/components/SubComponents/FormInstance/stories/mocks/advancedhtml.json +23 -0
  93. package/src/components/SubComponents/FormInstance/stories/mocks/autocomplete.json +34 -0
  94. package/src/components/SubComponents/FormInstance/stories/mocks/basichtml.json +15 -0
  95. package/src/components/SubComponents/FormInstance/stories/mocks/checkboxes.json +102 -0
  96. package/src/components/SubComponents/FormInstance/stories/mocks/checkboxesother.json +197 -0
  97. package/src/components/SubComponents/FormInstance/stories/mocks/container.json +134 -0
  98. package/src/components/SubComponents/FormInstance/stories/mocks/customcomposite.json +469 -0
  99. package/src/components/SubComponents/FormInstance/stories/mocks/date.json +19 -0
  100. package/src/components/SubComponents/FormInstance/stories/mocks/datelist.json +752 -0
  101. package/src/components/SubComponents/FormInstance/stories/mocks/datetime.json +89 -0
  102. package/src/components/SubComponents/FormInstance/stories/mocks/details.json +63 -0
  103. package/src/components/SubComponents/FormInstance/stories/mocks/email.json +18 -0
  104. package/src/components/SubComponents/FormInstance/stories/mocks/emailconfirm.json +110 -0
  105. package/src/components/SubComponents/FormInstance/stories/mocks/fieldset.json +62 -0
  106. package/src/components/SubComponents/FormInstance/stories/mocks/flexbox.json +58 -0
  107. package/src/components/SubComponents/FormInstance/stories/mocks/hidden.json +35 -0
  108. package/src/components/SubComponents/FormInstance/stories/mocks/horizontalrule.json +14 -0
  109. package/src/components/SubComponents/FormInstance/stories/mocks/jahd.json +1359 -0
  110. package/src/components/SubComponents/FormInstance/stories/mocks/label.json +14 -0
  111. package/src/components/SubComponents/FormInstance/stories/mocks/likert.json +375 -0
  112. package/src/components/SubComponents/FormInstance/stories/mocks/message.json +86 -0
  113. package/src/components/SubComponents/FormInstance/stories/mocks/more.json +19 -0
  114. package/src/components/SubComponents/FormInstance/stories/mocks/multiple.json +142 -0
  115. package/src/components/SubComponents/FormInstance/stories/mocks/number.json +35 -0
  116. package/src/components/SubComponents/FormInstance/stories/mocks/quad.json +249 -0
  117. package/src/components/SubComponents/FormInstance/stories/mocks/radios.json +70 -0
  118. package/src/components/SubComponents/FormInstance/stories/mocks/radiosother.json +176 -0
  119. package/src/components/SubComponents/FormInstance/stories/mocks/range.json +58 -0
  120. package/src/components/SubComponents/FormInstance/stories/mocks/rating.json +42 -0
  121. package/src/components/SubComponents/FormInstance/stories/mocks/rule-disabled-value.json +66 -0
  122. package/src/components/SubComponents/FormInstance/stories/mocks/rule-enabled-value.json +43 -0
  123. package/src/components/SubComponents/FormInstance/stories/mocks/rule-hidden-value.json +68 -0
  124. package/src/components/SubComponents/FormInstance/stories/mocks/rule-required-value.json +69 -0
  125. package/src/components/SubComponents/FormInstance/stories/mocks/rule-visible-value.json +157 -0
  126. package/src/components/SubComponents/FormInstance/stories/mocks/sameas.json +66 -0
  127. package/src/components/SubComponents/FormInstance/stories/mocks/scale.json +200 -0
  128. package/src/components/SubComponents/FormInstance/stories/mocks/section.json +63 -0
  129. package/src/components/SubComponents/FormInstance/stories/mocks/select.json +41 -0
  130. package/src/components/SubComponents/FormInstance/stories/mocks/selectother.json +115 -0
  131. package/src/components/SubComponents/FormInstance/stories/mocks/signature.json +25 -0
  132. package/src/components/SubComponents/FormInstance/stories/mocks/styles.json +81 -0
  133. package/src/components/SubComponents/FormInstance/stories/mocks/table-select.json +472 -0
  134. package/src/components/SubComponents/FormInstance/stories/mocks/table.json +154 -0
  135. package/src/components/SubComponents/FormInstance/stories/mocks/telephone.json +18 -0
  136. package/src/components/SubComponents/FormInstance/stories/mocks/textarea.json +22 -0
  137. package/src/components/SubComponents/FormInstance/stories/mocks/textfield.json +66 -0
  138. package/src/components/SubComponents/FormInstance/stories/mocks/time.json +20 -0
  139. package/src/components/SubComponents/FormInstance/stories/mocks/token.json +260 -0
  140. package/src/components/SubComponents/FormInstance/stories/mocks/twig.json +154 -0
  141. package/src/components/SubComponents/FormInstance/stories/mocks/url.json +18 -0
  142. package/src/components/SubComponents/FormInstance/stories/mocks/value.json +17 -0
  143. package/src/components/SubComponents/FormInstance/stories/mocks/wizard.json +353 -0
  144. package/src/components/SubComponents/FormInstance/stories/options.stories.js +98 -0
  145. package/src/components/SubComponents/FormInstance/stories/style.stories.js +55 -0
  146. package/src/components/SubComponents/FormInstance/stories/wizard.stories.js +55 -0
  147. package/src/components/SubComponents/FormInstance/style.scss +173 -0
  148. package/src/components/SubComponents/FormInstance/tests/address.test.js +255 -0
  149. package/src/components/SubComponents/FormInstance/tests/advancedhtml.test.js +31 -0
  150. package/src/components/SubComponents/FormInstance/tests/autocomplete.test.js +38 -0
  151. package/src/components/SubComponents/FormInstance/tests/basichtml.test.js +31 -0
  152. package/src/components/SubComponents/FormInstance/tests/checkbox.test.js +29 -0
  153. package/src/components/SubComponents/FormInstance/tests/checkboxes.test.js +44 -0
  154. package/src/components/SubComponents/FormInstance/tests/checkboxesother.test.js +91 -0
  155. package/src/components/SubComponents/FormInstance/tests/container.test.js +66 -0
  156. package/src/components/SubComponents/FormInstance/tests/customcomposite.test.js +86 -0
  157. package/src/components/SubComponents/FormInstance/tests/date.test.js +63 -0
  158. package/src/components/SubComponents/FormInstance/tests/datelist.test.js +136 -0
  159. package/src/components/SubComponents/FormInstance/tests/datetime.test.js +54 -0
  160. package/src/components/SubComponents/FormInstance/tests/details.test.js +58 -0
  161. package/src/components/SubComponents/FormInstance/tests/email.test.js +28 -0
  162. package/src/components/SubComponents/FormInstance/tests/emailconfirm.test.js +79 -0
  163. package/src/components/SubComponents/FormInstance/tests/fieldset.test.js +63 -0
  164. package/src/components/SubComponents/FormInstance/tests/flexbox.test.js +71 -0
  165. package/src/components/SubComponents/FormInstance/tests/form-test-utils.js +120 -0
  166. package/src/components/SubComponents/FormInstance/tests/form.test.js +26 -0
  167. package/src/components/SubComponents/FormInstance/tests/hidden.test.js +52 -0
  168. package/src/components/SubComponents/FormInstance/tests/horizontalrule.test.js +31 -0
  169. package/src/components/SubComponents/FormInstance/tests/label.test.js +31 -0
  170. package/src/components/SubComponents/FormInstance/tests/likert.test.js +38 -0
  171. package/src/components/SubComponents/FormInstance/tests/message.test.js +89 -0
  172. package/src/components/SubComponents/FormInstance/tests/more.test.js +32 -0
  173. package/src/components/SubComponents/FormInstance/tests/multiple.test.js +71 -0
  174. package/src/components/SubComponents/FormInstance/tests/number.test.js +51 -0
  175. package/src/components/SubComponents/FormInstance/tests/radios.test.js +34 -0
  176. package/src/components/SubComponents/FormInstance/tests/radiosother.test.js +79 -0
  177. package/src/components/SubComponents/FormInstance/tests/range.test.js +32 -0
  178. package/src/components/SubComponents/FormInstance/tests/rating.test.js +38 -0
  179. package/src/components/SubComponents/FormInstance/tests/rule-disabled.test.js +128 -0
  180. package/src/components/SubComponents/FormInstance/tests/rule-enabled-value.test.js +78 -0
  181. package/src/components/SubComponents/FormInstance/tests/rule-hidden.test.js +131 -0
  182. package/src/components/SubComponents/FormInstance/tests/rule-required-value.test.js +144 -0
  183. package/src/components/SubComponents/FormInstance/tests/rule-visible.test.js +619 -0
  184. package/src/components/SubComponents/FormInstance/tests/sameas.test.js +94 -0
  185. package/src/components/SubComponents/FormInstance/tests/scale.test.js +43 -0
  186. package/src/components/SubComponents/FormInstance/tests/section.test.js +63 -0
  187. package/src/components/SubComponents/FormInstance/tests/select.test.js +45 -0
  188. package/src/components/SubComponents/FormInstance/tests/selectother.test.js +82 -0
  189. package/src/components/SubComponents/FormInstance/tests/signature.test.js +32 -0
  190. package/src/components/SubComponents/FormInstance/tests/styles.test.js +73 -0
  191. package/src/components/SubComponents/FormInstance/tests/table-select.test.js +93 -0
  192. package/src/components/SubComponents/FormInstance/tests/table.test.js +97 -0
  193. package/src/components/SubComponents/FormInstance/tests/telephone.test.js +29 -0
  194. package/src/components/SubComponents/FormInstance/tests/textarea.test.js +29 -0
  195. package/src/components/SubComponents/FormInstance/tests/textfield.test.js +48 -0
  196. package/src/components/SubComponents/FormInstance/tests/time.test.js +29 -0
  197. package/src/components/SubComponents/FormInstance/tests/token.test.js +33 -0
  198. package/src/components/SubComponents/FormInstance/tests/twig.test.js +74 -0
  199. package/src/components/SubComponents/FormInstance/tests/url.test.js +45 -0
  200. package/src/components/SubComponents/FormInstance/tests/value.test.js +31 -0
  201. package/src/components/SubComponents/FormInstance/tests/wizard.test.js +145 -0
  202. package/src/mock/jest.fileMock.js +1 -0
  203. package/src/components/SubComponents/FormInstance/index.stories.js +0 -8
@@ -0,0 +1,43 @@
1
+ import json from '../stories/mocks/scale.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'scale'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ clearOnHide: true,
13
+ customClass: 'custom-formio-1',
14
+ defaultValue: '3',
15
+ disabled: false,
16
+ hideLabel: false,
17
+ id: 'kitchen_sink_formio_v1--scale1',
18
+ inline: true,
19
+ input: true,
20
+ key: 'scale1',
21
+ label: 'scale1',
22
+ labelPosition: 'top',
23
+ mask: false,
24
+ optionsLabelPosition: 'right',
25
+ type: 'scale',
26
+ validate: { max: 5, min: 1, required: false },
27
+ values: [
28
+ { checked: false, id: 0, label: '', value: 1 },
29
+ { checked: false, id: 0, label: '', value: 2 },
30
+ { checked: true, id: 0, label: '', value: 3 },
31
+ { checked: false, id: 0, label: '', value: 4 },
32
+ { checked: false, id: 0, label: '', value: 5 }
33
+ ]
34
+ }
35
+ ])
36
+ )
37
+ })
38
+
39
+ it(`should return a submission value`, () => {
40
+ const submission = FormTestUtils.handleSubmission(json, 3)
41
+ expect(submission).toEqual({ scale1: 3 })
42
+ })
43
+ })
@@ -0,0 +1,63 @@
1
+ import json from '../stories/mocks/section.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'section'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ clearOnHide: true,
13
+ components: [
14
+ {
15
+ content: '<h3>section1</h3>',
16
+ id: 'heading-titlekitchen_sink_formio_v1--section1',
17
+ input: false,
18
+ key: 'heading-titlesection1',
19
+ refreshOnChange: false,
20
+ tableView: false,
21
+ type: 'htmlelement'
22
+ },
23
+ {
24
+ content: 'this is a section',
25
+ id: 'heading-desckitchen_sink_formio_v1--section1',
26
+ input: false,
27
+ key: 'heading-descsection1',
28
+ refreshOnChange: false,
29
+ tableView: false,
30
+ type: 'htmlelement'
31
+ },
32
+ {
33
+ attributes: { counter: 3 },
34
+ clearOnHide: true,
35
+ customClass: 'custom-formio-3',
36
+ disabled: false,
37
+ hideLabel: false,
38
+ id: 'kitchen_sink_formio_v1--textfield1',
39
+ input: true,
40
+ key: 'textfield1',
41
+ label: 'textfield1',
42
+ labelPosition: 'top',
43
+ mask: false,
44
+ type: 'textfield',
45
+ validate: { maxLength: 255, required: false }
46
+ }
47
+ ],
48
+ customClass: 'custom-formio-1',
49
+ disabled: false,
50
+ hideLabel: true,
51
+ id: 'kitchen_sink_formio_v1--section1',
52
+ input: false,
53
+ key: 'section1',
54
+ label: 'section1',
55
+ labelPosition: 'top',
56
+ mask: false,
57
+ type: 'container',
58
+ validate: {}
59
+ }
60
+ ])
61
+ )
62
+ })
63
+ })
@@ -0,0 +1,45 @@
1
+ import json from '../stories/mocks/select.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'select'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ clearOnHide: true,
13
+ customClass: 'custom-formio-1',
14
+ data: {
15
+ values: [
16
+ { label: 'Mallee', value: '4941' },
17
+ { label: 'Wimmera Southern Mallee', value: '4946' },
18
+ { label: 'Loddon Campaspe', value: '4951' },
19
+ { label: 'Barwon', value: '4956' },
20
+ { label: 'Central Highlands', value: '4961' },
21
+ { label: 'Gippsland', value: '4966' },
22
+ { label: 'Goulburn', value: '4971' },
23
+ { label: 'Great South Coast', value: '4976' },
24
+ { label: 'Ovens Murray', value: '4981' },
25
+ { label: 'Melbourne', value: '4986' },
26
+ { label: 'Online', value: '8446' },
27
+ { label: '- None -', value: '_empty_' }
28
+ ]
29
+ },
30
+ disabled: false,
31
+ hideLabel: false,
32
+ id: 'kitchen_sink_formio_v1--termselect1',
33
+ input: true,
34
+ key: 'termselect1',
35
+ label: 'termselect1',
36
+ labelPosition: 'top',
37
+ mask: false,
38
+ type: 'select',
39
+ validate: { required: false },
40
+ widget: 'choicesjs'
41
+ }
42
+ ])
43
+ )
44
+ })
45
+ })
@@ -0,0 +1,82 @@
1
+ import json from '../stories/mocks/selectother.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'selectother'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ clearOnHide: true,
13
+ columns: [
14
+ {
15
+ components: [
16
+ {
17
+ attributes: { counter: 3 },
18
+ clearOnHide: true,
19
+ customClass: 'custom-formio-3',
20
+ data: {
21
+ values: [
22
+ { label: '- Select -', value: '_empty_' },
23
+ { label: 'Male', value: 'Male' },
24
+ { label: 'Female', value: 'Female' },
25
+ { label: 'Transgender', value: 'Transgender' },
26
+ { label: 'Other…', value: '_other_' }
27
+ ]
28
+ },
29
+ defaultValue: null,
30
+ disabled: false,
31
+ hideLabel: true,
32
+ id: 0,
33
+ input: true,
34
+ key: 0,
35
+ label: 'so1',
36
+ mask: false,
37
+ type: 'select',
38
+ validate: { required: true },
39
+ widget: 'choicesjs'
40
+ }
41
+ ],
42
+ width: 12
43
+ },
44
+ {
45
+ components: [
46
+ {
47
+ attributes: { counter: 4 },
48
+ clearOnHide: true,
49
+ conditional: { eq: '_other_', show: true, when: 0 },
50
+ customClass: 'custom-formio-4',
51
+ disabled: false,
52
+ hideLabel: true,
53
+ id: 0,
54
+ input: true,
55
+ key: 0,
56
+ label: 'Enter other…',
57
+ mask: false,
58
+ placeholder: 'Enter other…',
59
+ type: 'textfield',
60
+ validate: { maxLength: 255, required: true }
61
+ }
62
+ ],
63
+ width: 12
64
+ }
65
+ ],
66
+ customClass: 'custom-formio-1',
67
+ defaultValue: { other: null, select: null },
68
+ disabled: false,
69
+ hideLabel: true,
70
+ id: 'kitchen_sink_formio_v1--so1',
71
+ input: false,
72
+ key: 'so1',
73
+ label: 'so1',
74
+ labelPosition: 'top',
75
+ mask: false,
76
+ type: 'columns',
77
+ validate: {}
78
+ }
79
+ ])
80
+ )
81
+ })
82
+ })
@@ -0,0 +1,32 @@
1
+ import json from '../stories/mocks/signature.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'signature'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ clearOnHide: true,
13
+ customClass: 'custom-formio-1',
14
+ description: {
15
+ '#markup': 'Sign above',
16
+ '#theme': 'webform_html_editor_markup'
17
+ },
18
+ disabled: false,
19
+ hideLabel: false,
20
+ id: 'kitchen_sink_formio_v1--signature1',
21
+ input: true,
22
+ key: 'signature1',
23
+ label: 'signature1',
24
+ labelPosition: 'top',
25
+ mask: false,
26
+ type: 'signature',
27
+ validate: { required: false }
28
+ }
29
+ ])
30
+ )
31
+ })
32
+ })
@@ -0,0 +1,73 @@
1
+ import json from '../stories/mocks/styles.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'styles'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ clearOnHide: true,
13
+ customClass: 'custom-formio-1',
14
+ disabled: false,
15
+ hideLabel: false,
16
+ id: 'kitchen_sink_formio_v1--full_name',
17
+ input: true,
18
+ key: 'full_name',
19
+ label: 'Label in red style override',
20
+ labelPosition: 'top',
21
+ mask: false,
22
+ type: 'textfield',
23
+ validate: { maxLength: 255, required: true }
24
+ },
25
+ {
26
+ attributes: { counter: 2 },
27
+ clearOnHide: true,
28
+ customClass: 'custom-formio-2',
29
+ disabled: false,
30
+ hideLabel: false,
31
+ id: 'kitchen_sink_formio_v1--wrapper_with_green_background',
32
+ input: true,
33
+ key: 'wrapper_with_green_background',
34
+ label: 'wrapper with yellow background',
35
+ labelPosition: 'top',
36
+ mask: false,
37
+ type: 'textfield',
38
+ validate: { maxLength: 255, required: false }
39
+ },
40
+ {
41
+ attributes: { counter: 3 },
42
+ clearOnHide: true,
43
+ customClass: 'custom-formio-3',
44
+ disabled: false,
45
+ hideLabel: false,
46
+ id: 'kitchen_sink_formio_v1--input_with_text_transform',
47
+ input: true,
48
+ key: 'input_with_text_transform',
49
+ label: 'input with background',
50
+ labelPosition: 'top',
51
+ mask: false,
52
+ type: 'textfield',
53
+ validate: { maxLength: 255, required: false }
54
+ },
55
+ {
56
+ attributes: { counter: 4 },
57
+ clearOnHide: true,
58
+ customClass: 'custom-formio-4',
59
+ disabled: false,
60
+ hideLabel: false,
61
+ id: 'kitchen_sink_formio_v1--element_without_styles',
62
+ input: true,
63
+ key: 'element_without_styles',
64
+ label: 'element without styles',
65
+ labelPosition: 'top',
66
+ mask: false,
67
+ type: 'textfield',
68
+ validate: { maxLength: 255, required: false }
69
+ }
70
+ ])
71
+ )
72
+ })
73
+ })
@@ -0,0 +1,93 @@
1
+ import json from '../stories/mocks/table-select.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'table-select'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ clearOnHide: true,
13
+ customClass: 'custom-formio-1',
14
+ defaultValue: {
15
+ value: []
16
+ },
17
+ disabled: false,
18
+ hideLabel: false,
19
+ id: 'test--rer',
20
+ input: true,
21
+ key: 'rer',
22
+ label: 'Single Select',
23
+ labelPosition: 'top',
24
+ mask: false,
25
+ numberOfSelections: 1,
26
+ type: 'tableselect',
27
+ validate: { required: false },
28
+ values: [
29
+ { checked: false, label: 'test 2', value: 'test 2' },
30
+ { checked: false, label: 'test1', value: 'test1' }
31
+ ]
32
+ },
33
+ {
34
+ attributes: { counter: 2 },
35
+ clearOnHide: true,
36
+ customClass: 'custom-formio-2',
37
+ defaultValue: {
38
+ value: []
39
+ },
40
+ disabled: false,
41
+ hideLabel: false,
42
+ id: 'test--rer2',
43
+ input: true,
44
+ key: 'rer2',
45
+ label: 'Multi-Select',
46
+ labelPosition: 'top',
47
+ mask: false,
48
+ numberOfSelections: 2,
49
+ type: 'tableselect',
50
+ validate: { required: false },
51
+ values: [
52
+ {
53
+ checked: false,
54
+ label:
55
+ 'Allows the end user to enter rich text such as headings, paragraphs and bolding. Submits it as HTML and which then can be sent in a submission email',
56
+ value: 'test 2'
57
+ },
58
+ { checked: false, label: 'test1', value: 'test1' }
59
+ ]
60
+ },
61
+ {
62
+ attributes: { counter: 3 },
63
+ clearOnHide: true,
64
+ customClass: 'custom-formio-3',
65
+ defaultValue: {
66
+ value: []
67
+ },
68
+ disabled: false,
69
+ hideLabel: false,
70
+ id: 'test--lim',
71
+ input: true,
72
+ key: 'lim',
73
+ label: 'Select only 2',
74
+ labelPosition: 'top',
75
+ mask: false,
76
+ numberOfSelections: 2,
77
+ type: 'tableselect',
78
+ validate: { required: false },
79
+ values: [
80
+ {
81
+ checked: false,
82
+ label:
83
+ 'Allows the end user to enter rich text such as headings, paragraphs and bolding. Submits it as HTML and which then can be sent in a submission email',
84
+ value: 'test 2'
85
+ },
86
+ { checked: false, label: 'test1', value: 'test1' },
87
+ { checked: false, label: 'aaa dddd', value: 'aaa' }
88
+ ]
89
+ }
90
+ ])
91
+ )
92
+ })
93
+ })
@@ -0,0 +1,97 @@
1
+ import json from '../stories/mocks/table.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'table'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ cellAlignment: 'left',
13
+ clearOnHide: true,
14
+ customClass: 'custom-formio-1',
15
+ disabled: false,
16
+ hideLabel: true,
17
+ id: 'kitchen_sink_formio_v1--t1',
18
+ input: false,
19
+ key: 't1',
20
+ label: 't1',
21
+ labelPosition: 'top',
22
+ mask: false,
23
+ numCols: 2,
24
+ numRows: 2,
25
+ rows: [
26
+ [
27
+ {
28
+ components: [
29
+ {
30
+ content: '<strong>table header 1</strong>',
31
+ id: 'table-heading-0kitchen_sink_formio_v1--t1',
32
+ key: 'table-heading-0t1',
33
+ refreshOnChange: false,
34
+ type: 'htmlelement'
35
+ }
36
+ ]
37
+ },
38
+ {
39
+ components: [
40
+ {
41
+ content: '<strong>table header 2</strong>',
42
+ id: 'table-heading-1kitchen_sink_formio_v1--t1',
43
+ key: 'table-heading-1t1',
44
+ refreshOnChange: false,
45
+ type: 'htmlelement'
46
+ }
47
+ ]
48
+ }
49
+ ],
50
+ [
51
+ {
52
+ components: [
53
+ {
54
+ attributes: { counter: 4 },
55
+ clearOnHide: true,
56
+ customClass: 'custom-formio-4',
57
+ disabled: false,
58
+ hideLabel: false,
59
+ id: 'kitchen_sink_formio_v1--t1_01_txt1',
60
+ input: true,
61
+ key: 't1_01_txt1',
62
+ label: 'txt1',
63
+ labelPosition: 'top',
64
+ mask: false,
65
+ type: 'textfield',
66
+ validate: { maxLength: 255, required: false }
67
+ }
68
+ ]
69
+ },
70
+ {
71
+ components: [
72
+ {
73
+ attributes: { counter: 5 },
74
+ clearOnHide: true,
75
+ customClass: 'custom-formio-5',
76
+ disabled: false,
77
+ hideLabel: false,
78
+ id: 'kitchen_sink_formio_v1--t1_01_txt2',
79
+ input: true,
80
+ key: 't1_01_txt2',
81
+ label: 'txt2',
82
+ labelPosition: 'top',
83
+ mask: false,
84
+ type: 'textfield',
85
+ validate: { maxLength: 255, required: false }
86
+ }
87
+ ]
88
+ }
89
+ ]
90
+ ],
91
+ type: 'table',
92
+ validate: {}
93
+ }
94
+ ])
95
+ )
96
+ })
97
+ })
@@ -0,0 +1,29 @@
1
+ import json from '../stories/mocks/telephone.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'telephone'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ clearOnHide: true,
13
+ customClass: 'custom-formio-1',
14
+ disabled: false,
15
+ hideLabel: false,
16
+ id: 'kitchen_sink_formio_v1--telephone1',
17
+ input: true,
18
+ inputMask: '99 9999 9999',
19
+ key: 'telephone1',
20
+ label: 'telephone1',
21
+ labelPosition: 'top',
22
+ mask: false,
23
+ type: 'phoneNumber',
24
+ validate: { maxLength: 128, required: false }
25
+ }
26
+ ])
27
+ )
28
+ })
29
+ })
@@ -0,0 +1,29 @@
1
+ import json from '../stories/mocks/textarea.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'TextArea'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ autoExpand: true,
13
+ clearOnHide: true,
14
+ customClass: 'custom-formio-1',
15
+ disabled: false,
16
+ hideLabel: false,
17
+ id: 'kitchen_sink_formio_v1--textarea1',
18
+ input: true,
19
+ key: 'textarea1',
20
+ label: 'textarea1',
21
+ labelPosition: 'top',
22
+ mask: false,
23
+ type: 'textarea',
24
+ validate: { required: false }
25
+ }
26
+ ])
27
+ )
28
+ })
29
+ })
@@ -0,0 +1,48 @@
1
+ import json from '../stories/mocks/textfield.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'TextField'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 2 },
12
+ clearOnHide: true,
13
+ customClass: 'custom-formio-2',
14
+ description: {
15
+ '#markup': 'Description text',
16
+ '#theme': 'webform_html_editor_markup'
17
+ },
18
+ disabled: false,
19
+ hideLabel: false,
20
+ id: 'kitchen_sink_formio_v1--t18',
21
+ input: true,
22
+ key: 't18',
23
+ label: 'Title text',
24
+ labelPosition: 'top',
25
+ mask: false,
26
+ placeholder: 'placeholderx',
27
+ type: 'textfield',
28
+ validate: { maxLength: 255, required: false }
29
+ },
30
+ {
31
+ attributes: { counter: 3 },
32
+ clearOnHide: true,
33
+ customClass: 'custom-formio-3',
34
+ disabled: false,
35
+ hideLabel: false,
36
+ id: 'kitchen_sink_formio_v1--textfield_regex_abc',
37
+ input: true,
38
+ key: 'textfield_regex_abc',
39
+ label: 'textfield with pattern ab+c',
40
+ labelPosition: 'top',
41
+ mask: false,
42
+ type: 'textfield',
43
+ validate: { maxLength: 255, pattern: 'ab+c', required: false }
44
+ }
45
+ ])
46
+ )
47
+ })
48
+ })
@@ -0,0 +1,29 @@
1
+ import json from '../stories/mocks/time.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'time'
5
+ describe(`Form ${testComponent} parser`, () => {
6
+ it(`should render a ${testComponent} component`, () => {
7
+ const components = FormTestUtils.getParsedComponentsFromJSON(json)
8
+ expect(components).toEqual(
9
+ FormTestUtils.getComparisonJSON([
10
+ {
11
+ attributes: { counter: 1 },
12
+ clearOnHide: true,
13
+ customClass: 'custom-formio-1',
14
+ disabled: false,
15
+ hideLabel: false,
16
+ id: 'kitchen_sink_formio_v1--time1',
17
+ input: true,
18
+ inputMask: '99:99',
19
+ key: 'time1',
20
+ label: 'time1',
21
+ labelPosition: 'top',
22
+ mask: false,
23
+ type: 'time',
24
+ validate: { maxLength: 12, required: false }
25
+ }
26
+ ])
27
+ )
28
+ })
29
+ })