@worksafevictoria/wcl7.5 1.1.10 → 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 (214) hide show
  1. package/jest.config.js +9 -7
  2. package/package.json +6 -5
  3. package/src/components/Paragraphs/Accordion/index.stories.js +1 -0
  4. package/src/components/Paragraphs/Breakout/index.stories.js +1 -0
  5. package/src/components/Paragraphs/BrowseContent/index.stories.js +1 -0
  6. package/src/components/Paragraphs/Calculator/Constants.js +2 -2
  7. package/src/components/Paragraphs/Calculator/index.stories.js +1 -0
  8. package/src/components/Paragraphs/Directory/Records/CJ/index.vue +3 -3
  9. package/src/components/Paragraphs/Directory/Records/ISP/index.vue +3 -3
  10. package/src/components/Paragraphs/Directory/Records/PRS/index.vue +2 -2
  11. package/src/components/Paragraphs/Directory/Records/PRS/recordContent.vue +3 -3
  12. package/src/components/Paragraphs/Directory/Records/PRS/recordDetails.vue +3 -3
  13. package/src/components/Paragraphs/Directory/Records/index.vue +3 -3
  14. package/src/components/Paragraphs/Directory/index.vue +4 -4
  15. package/src/components/Paragraphs/ListGroup/Link/list-link.stories.js +1 -0
  16. package/src/components/Paragraphs/ListGroup/list-group.stories.js +1 -0
  17. package/src/components/Paragraphs/ListGroup/navigation-card.stories.js +1 -0
  18. package/src/components/Paragraphs/MarketingBanner/index.stories.js +1 -0
  19. package/src/components/Paragraphs/ProofPoints/index.stories.js +19 -20
  20. package/src/components/Paragraphs/RelatedInformation/index.stories.js +7 -0
  21. package/src/components/Paragraphs/Webform/index.stories.js +30 -29
  22. package/src/components/Paragraphs/Webform/index.vue +10 -7
  23. package/src/components/SubComponents/FormInstance/components/alert/index.vue +129 -0
  24. package/src/components/SubComponents/FormInstance/components/custom/base-formio.js +77 -0
  25. package/src/components/SubComponents/FormInstance/components/custom/code-formio.js +35 -0
  26. package/src/components/SubComponents/FormInstance/components/custom/custom-formio-registry.js +30 -0
  27. package/src/components/SubComponents/FormInstance/components/custom/range-formio.js +121 -0
  28. package/src/components/SubComponents/FormInstance/components/custom/rating-formio.js +121 -0
  29. package/src/components/SubComponents/FormInstance/components/custom/scale-formio.js +99 -0
  30. package/src/components/SubComponents/FormInstance/components/custom/tableselect-formio.js +200 -0
  31. package/src/components/SubComponents/FormInstance/components/handler/index.vue +208 -0
  32. package/src/components/SubComponents/FormInstance/components/renderer/index.vue +282 -0
  33. package/src/components/SubComponents/FormInstance/index.test.js +65 -0
  34. package/src/components/SubComponents/FormInstance/index.vue +55 -6
  35. package/src/components/SubComponents/FormInstance/models/base-form-element.js +338 -0
  36. package/src/components/SubComponents/FormInstance/models/form-callback-queue.js +45 -0
  37. package/src/components/SubComponents/FormInstance/models/form-utils.js +50 -0
  38. package/src/components/SubComponents/FormInstance/models/overrides/address.js +132 -0
  39. package/src/components/SubComponents/FormInstance/models/overrides/autocomplete.js +41 -0
  40. package/src/components/SubComponents/FormInstance/models/overrides/checkbox.js +14 -0
  41. package/src/components/SubComponents/FormInstance/models/overrides/checkboxes.js +49 -0
  42. package/src/components/SubComponents/FormInstance/models/overrides/code.js +27 -0
  43. package/src/components/SubComponents/FormInstance/models/overrides/composite.js +57 -0
  44. package/src/components/SubComponents/FormInstance/models/overrides/container.js +65 -0
  45. package/src/components/SubComponents/FormInstance/models/overrides/currency.js +17 -0
  46. package/src/components/SubComponents/FormInstance/models/overrides/customcomposite.js +41 -0
  47. package/src/components/SubComponents/FormInstance/models/overrides/date.js +126 -0
  48. package/src/components/SubComponents/FormInstance/models/overrides/datelist.js +73 -0
  49. package/src/components/SubComponents/FormInstance/models/overrides/detail.js +38 -0
  50. package/src/components/SubComponents/FormInstance/models/overrides/email-confirm.js +12 -0
  51. package/src/components/SubComponents/FormInstance/models/overrides/email.js +7 -0
  52. package/src/components/SubComponents/FormInstance/models/overrides/file.js +56 -0
  53. package/src/components/SubComponents/FormInstance/models/overrides/flexbox.js +33 -0
  54. package/src/components/SubComponents/FormInstance/models/overrides/hidden.js +24 -0
  55. package/src/components/SubComponents/FormInstance/models/overrides/likert.js +40 -0
  56. package/src/components/SubComponents/FormInstance/models/overrides/markup.js +47 -0
  57. package/src/components/SubComponents/FormInstance/models/overrides/message.js +53 -0
  58. package/src/components/SubComponents/FormInstance/models/overrides/moretext.js +64 -0
  59. package/src/components/SubComponents/FormInstance/models/overrides/multiple.js +51 -0
  60. package/src/components/SubComponents/FormInstance/models/overrides/number.js +22 -0
  61. package/src/components/SubComponents/FormInstance/models/overrides/options-other.js +34 -0
  62. package/src/components/SubComponents/FormInstance/models/overrides/page.js +7 -0
  63. package/src/components/SubComponents/FormInstance/models/overrides/phonenumber.js +13 -0
  64. package/src/components/SubComponents/FormInstance/models/overrides/radio.js +31 -0
  65. package/src/components/SubComponents/FormInstance/models/overrides/range.js +19 -0
  66. package/src/components/SubComponents/FormInstance/models/overrides/rating.js +47 -0
  67. package/src/components/SubComponents/FormInstance/models/overrides/scale.js +33 -0
  68. package/src/components/SubComponents/FormInstance/models/overrides/section.js +39 -0
  69. package/src/components/SubComponents/FormInstance/models/overrides/select.js +28 -0
  70. package/src/components/SubComponents/FormInstance/models/overrides/signature.js +7 -0
  71. package/src/components/SubComponents/FormInstance/models/overrides/submit.js +23 -0
  72. package/src/components/SubComponents/FormInstance/models/overrides/table.js +48 -0
  73. package/src/components/SubComponents/FormInstance/models/overrides/tablerow.js +20 -0
  74. package/src/components/SubComponents/FormInstance/models/overrides/tableselect.js +66 -0
  75. package/src/components/SubComponents/FormInstance/models/overrides/testing.js +47 -0
  76. package/src/components/SubComponents/FormInstance/models/overrides/text.js +7 -0
  77. package/src/components/SubComponents/FormInstance/models/overrides/textarea.js +26 -0
  78. package/src/components/SubComponents/FormInstance/models/overrides/textformat.js +13 -0
  79. package/src/components/SubComponents/FormInstance/models/overrides/time.js +13 -0
  80. package/src/components/SubComponents/FormInstance/models/overrides/twig.js +118 -0
  81. package/src/components/SubComponents/FormInstance/models/overrides/unknown.js +24 -0
  82. package/src/components/SubComponents/FormInstance/models/overrides/url.js +13 -0
  83. package/src/components/SubComponents/FormInstance/services/convert-form-element.js +49 -0
  84. package/src/components/SubComponents/FormInstance/services/form-api.js +47 -0
  85. package/src/components/SubComponents/FormInstance/services/form-render-parser.js +156 -0
  86. package/src/components/SubComponents/FormInstance/services/form-submit-parser.js +61 -0
  87. package/src/components/SubComponents/FormInstance/services/logic-linker.js +73 -0
  88. package/src/components/SubComponents/FormInstance/services/logic-parser.js +173 -0
  89. package/src/components/SubComponents/FormInstance/services/registry-factory.js +284 -0
  90. package/src/components/SubComponents/FormInstance/stories/Documentation.mdx +234 -0
  91. package/src/components/SubComponents/FormInstance/stories/advanced.stories.js +109 -0
  92. package/src/components/SubComponents/FormInstance/stories/basic.stories.js +73 -0
  93. package/src/components/SubComponents/FormInstance/stories/build.stories.js +27 -0
  94. package/src/components/SubComponents/FormInstance/stories/composite.stories.js +90 -0
  95. package/src/components/SubComponents/FormInstance/stories/condition.stories.js +83 -0
  96. package/src/components/SubComponents/FormInstance/stories/custom.stories.js +69 -0
  97. package/src/components/SubComponents/FormInstance/stories/date.stories.js +76 -0
  98. package/src/components/SubComponents/FormInstance/stories/form-alert.stories.js +93 -0
  99. package/src/components/SubComponents/FormInstance/stories/index.stories.js +63 -0
  100. package/src/components/SubComponents/FormInstance/stories/layout.stories.js +85 -0
  101. package/src/components/SubComponents/FormInstance/stories/markup.stories.js +91 -0
  102. package/src/components/SubComponents/FormInstance/stories/mocks/address.json +298 -0
  103. package/src/components/SubComponents/FormInstance/stories/mocks/advancedhtml.json +23 -0
  104. package/src/components/SubComponents/FormInstance/stories/mocks/autocomplete.json +34 -0
  105. package/src/components/SubComponents/FormInstance/stories/mocks/basichtml.json +15 -0
  106. package/src/components/SubComponents/FormInstance/stories/mocks/checkboxes.json +102 -0
  107. package/src/components/SubComponents/FormInstance/stories/mocks/checkboxesother.json +197 -0
  108. package/src/components/SubComponents/FormInstance/stories/mocks/container.json +134 -0
  109. package/src/components/SubComponents/FormInstance/stories/mocks/customcomposite.json +469 -0
  110. package/src/components/SubComponents/FormInstance/stories/mocks/date.json +19 -0
  111. package/src/components/SubComponents/FormInstance/stories/mocks/datelist.json +752 -0
  112. package/src/components/SubComponents/FormInstance/stories/mocks/datetime.json +89 -0
  113. package/src/components/SubComponents/FormInstance/stories/mocks/details.json +63 -0
  114. package/src/components/SubComponents/FormInstance/stories/mocks/email.json +18 -0
  115. package/src/components/SubComponents/FormInstance/stories/mocks/emailconfirm.json +110 -0
  116. package/src/components/SubComponents/FormInstance/stories/mocks/fieldset.json +62 -0
  117. package/src/components/SubComponents/FormInstance/stories/mocks/flexbox.json +58 -0
  118. package/src/components/SubComponents/FormInstance/stories/mocks/hidden.json +35 -0
  119. package/src/components/SubComponents/FormInstance/stories/mocks/horizontalrule.json +14 -0
  120. package/src/components/SubComponents/FormInstance/stories/mocks/jahd.json +1359 -0
  121. package/src/components/SubComponents/FormInstance/stories/mocks/label.json +14 -0
  122. package/src/components/SubComponents/FormInstance/stories/mocks/likert.json +375 -0
  123. package/src/components/SubComponents/FormInstance/stories/mocks/message.json +86 -0
  124. package/src/components/SubComponents/FormInstance/stories/mocks/more.json +19 -0
  125. package/src/components/SubComponents/FormInstance/stories/mocks/multiple.json +142 -0
  126. package/src/components/SubComponents/FormInstance/stories/mocks/number.json +35 -0
  127. package/src/components/SubComponents/FormInstance/stories/mocks/quad.json +249 -0
  128. package/src/components/SubComponents/FormInstance/stories/mocks/radios.json +70 -0
  129. package/src/components/SubComponents/FormInstance/stories/mocks/radiosother.json +176 -0
  130. package/src/components/SubComponents/FormInstance/stories/mocks/range.json +58 -0
  131. package/src/components/SubComponents/FormInstance/stories/mocks/rating.json +42 -0
  132. package/src/components/SubComponents/FormInstance/stories/mocks/rule-disabled-value.json +66 -0
  133. package/src/components/SubComponents/FormInstance/stories/mocks/rule-enabled-value.json +43 -0
  134. package/src/components/SubComponents/FormInstance/stories/mocks/rule-hidden-value.json +68 -0
  135. package/src/components/SubComponents/FormInstance/stories/mocks/rule-required-value.json +69 -0
  136. package/src/components/SubComponents/FormInstance/stories/mocks/rule-visible-value.json +157 -0
  137. package/src/components/SubComponents/FormInstance/stories/mocks/sameas.json +66 -0
  138. package/src/components/SubComponents/FormInstance/stories/mocks/scale.json +200 -0
  139. package/src/components/SubComponents/FormInstance/stories/mocks/section.json +63 -0
  140. package/src/components/SubComponents/FormInstance/stories/mocks/select.json +41 -0
  141. package/src/components/SubComponents/FormInstance/stories/mocks/selectother.json +115 -0
  142. package/src/components/SubComponents/FormInstance/stories/mocks/signature.json +25 -0
  143. package/src/components/SubComponents/FormInstance/stories/mocks/styles.json +81 -0
  144. package/src/components/SubComponents/FormInstance/stories/mocks/table-select.json +472 -0
  145. package/src/components/SubComponents/FormInstance/stories/mocks/table.json +154 -0
  146. package/src/components/SubComponents/FormInstance/stories/mocks/telephone.json +18 -0
  147. package/src/components/SubComponents/FormInstance/stories/mocks/textarea.json +22 -0
  148. package/src/components/SubComponents/FormInstance/stories/mocks/textfield.json +66 -0
  149. package/src/components/SubComponents/FormInstance/stories/mocks/time.json +20 -0
  150. package/src/components/SubComponents/FormInstance/stories/mocks/token.json +260 -0
  151. package/src/components/SubComponents/FormInstance/stories/mocks/twig.json +154 -0
  152. package/src/components/SubComponents/FormInstance/stories/mocks/url.json +18 -0
  153. package/src/components/SubComponents/FormInstance/stories/mocks/value.json +17 -0
  154. package/src/components/SubComponents/FormInstance/stories/mocks/wizard.json +353 -0
  155. package/src/components/SubComponents/FormInstance/stories/options.stories.js +98 -0
  156. package/src/components/SubComponents/FormInstance/stories/style.stories.js +55 -0
  157. package/src/components/SubComponents/FormInstance/stories/wizard.stories.js +55 -0
  158. package/src/components/SubComponents/FormInstance/style.scss +173 -0
  159. package/src/components/SubComponents/FormInstance/tests/address.test.js +255 -0
  160. package/src/components/SubComponents/FormInstance/tests/advancedhtml.test.js +31 -0
  161. package/src/components/SubComponents/FormInstance/tests/autocomplete.test.js +38 -0
  162. package/src/components/SubComponents/FormInstance/tests/basichtml.test.js +31 -0
  163. package/src/components/SubComponents/FormInstance/tests/checkbox.test.js +29 -0
  164. package/src/components/SubComponents/FormInstance/tests/checkboxes.test.js +44 -0
  165. package/src/components/SubComponents/FormInstance/tests/checkboxesother.test.js +91 -0
  166. package/src/components/SubComponents/FormInstance/tests/container.test.js +66 -0
  167. package/src/components/SubComponents/FormInstance/tests/customcomposite.test.js +86 -0
  168. package/src/components/SubComponents/FormInstance/tests/date.test.js +63 -0
  169. package/src/components/SubComponents/FormInstance/tests/datelist.test.js +136 -0
  170. package/src/components/SubComponents/FormInstance/tests/datetime.test.js +54 -0
  171. package/src/components/SubComponents/FormInstance/tests/details.test.js +58 -0
  172. package/src/components/SubComponents/FormInstance/tests/email.test.js +28 -0
  173. package/src/components/SubComponents/FormInstance/tests/emailconfirm.test.js +79 -0
  174. package/src/components/SubComponents/FormInstance/tests/fieldset.test.js +63 -0
  175. package/src/components/SubComponents/FormInstance/tests/flexbox.test.js +71 -0
  176. package/src/components/SubComponents/FormInstance/tests/form-test-utils.js +120 -0
  177. package/src/components/SubComponents/FormInstance/tests/form.test.js +26 -0
  178. package/src/components/SubComponents/FormInstance/tests/hidden.test.js +52 -0
  179. package/src/components/SubComponents/FormInstance/tests/horizontalrule.test.js +31 -0
  180. package/src/components/SubComponents/FormInstance/tests/label.test.js +31 -0
  181. package/src/components/SubComponents/FormInstance/tests/likert.test.js +38 -0
  182. package/src/components/SubComponents/FormInstance/tests/message.test.js +89 -0
  183. package/src/components/SubComponents/FormInstance/tests/more.test.js +32 -0
  184. package/src/components/SubComponents/FormInstance/tests/multiple.test.js +71 -0
  185. package/src/components/SubComponents/FormInstance/tests/number.test.js +51 -0
  186. package/src/components/SubComponents/FormInstance/tests/radios.test.js +34 -0
  187. package/src/components/SubComponents/FormInstance/tests/radiosother.test.js +79 -0
  188. package/src/components/SubComponents/FormInstance/tests/range.test.js +32 -0
  189. package/src/components/SubComponents/FormInstance/tests/rating.test.js +38 -0
  190. package/src/components/SubComponents/FormInstance/tests/rule-disabled.test.js +128 -0
  191. package/src/components/SubComponents/FormInstance/tests/rule-enabled-value.test.js +78 -0
  192. package/src/components/SubComponents/FormInstance/tests/rule-hidden.test.js +131 -0
  193. package/src/components/SubComponents/FormInstance/tests/rule-required-value.test.js +144 -0
  194. package/src/components/SubComponents/FormInstance/tests/rule-visible.test.js +619 -0
  195. package/src/components/SubComponents/FormInstance/tests/sameas.test.js +94 -0
  196. package/src/components/SubComponents/FormInstance/tests/scale.test.js +43 -0
  197. package/src/components/SubComponents/FormInstance/tests/section.test.js +63 -0
  198. package/src/components/SubComponents/FormInstance/tests/select.test.js +45 -0
  199. package/src/components/SubComponents/FormInstance/tests/selectother.test.js +82 -0
  200. package/src/components/SubComponents/FormInstance/tests/signature.test.js +32 -0
  201. package/src/components/SubComponents/FormInstance/tests/styles.test.js +73 -0
  202. package/src/components/SubComponents/FormInstance/tests/table-select.test.js +93 -0
  203. package/src/components/SubComponents/FormInstance/tests/table.test.js +97 -0
  204. package/src/components/SubComponents/FormInstance/tests/telephone.test.js +29 -0
  205. package/src/components/SubComponents/FormInstance/tests/textarea.test.js +29 -0
  206. package/src/components/SubComponents/FormInstance/tests/textfield.test.js +48 -0
  207. package/src/components/SubComponents/FormInstance/tests/time.test.js +29 -0
  208. package/src/components/SubComponents/FormInstance/tests/token.test.js +33 -0
  209. package/src/components/SubComponents/FormInstance/tests/twig.test.js +74 -0
  210. package/src/components/SubComponents/FormInstance/tests/url.test.js +45 -0
  211. package/src/components/SubComponents/FormInstance/tests/value.test.js +31 -0
  212. package/src/components/SubComponents/FormInstance/tests/wizard.test.js +145 -0
  213. package/src/mock/jest.fileMock.js +1 -0
  214. package/src/components/SubComponents/FormInstance/index.stories.js +0 -8
@@ -0,0 +1,173 @@
1
+ @import '../../../includes/scss/all.scss';
2
+ @import '../../../assets/styles/generated-icons.scss';
3
+
4
+ $button-base-unit: 8px;
5
+ $min-width: 163px;
6
+
7
+ h1,
8
+ h2,
9
+ h3,
10
+ h4,
11
+ h5,
12
+ h6,
13
+ .h1,
14
+ .h2,
15
+ .h3,
16
+ .h4,
17
+ .h5,
18
+ .h6 {
19
+ font-weight: 700;
20
+ }
21
+
22
+ a {
23
+ color: inherit;
24
+ text-decoration: underline;
25
+ }
26
+
27
+ label {
28
+ font-weight: 700;
29
+ font-size: 1.2rem;
30
+ color: $black;
31
+ line-height: 20px;
32
+ }
33
+
34
+ .radio {
35
+ label {
36
+ font-weight: normal;
37
+ font-size: 1rem;
38
+ }
39
+ }
40
+ .wizard-header {
41
+ &__steps {
42
+ font-weight: 700;
43
+ font-size: 1.5rem;
44
+ color: $darkgray;
45
+ }
46
+ }
47
+ input,
48
+ textarea {
49
+ border-radius: 8px;
50
+ border: 1px solid $gray;
51
+ }
52
+
53
+ .form-text {
54
+ font-weight: 500;
55
+ font-size: 1rem;
56
+ }
57
+
58
+ .more-text {
59
+ &__buttons {
60
+ font-size: 1rem;
61
+ font-weight: 600;
62
+ }
63
+ }
64
+
65
+ .form-group,
66
+ .formio-component {
67
+ margin-bottom: 32px;
68
+ }
69
+
70
+ .field-required:after,
71
+ .tab-error::after {
72
+ content: ' (Required)';
73
+ font-size: 14px;
74
+ color: $red;
75
+ font-weight: normal;
76
+ }
77
+
78
+ .was-validated .form-control:invalid,
79
+ .form-control.is-invalid {
80
+ border-color: $red;
81
+ background-image: none;
82
+ }
83
+
84
+ .formio-errors .error {
85
+ // color: $red;
86
+ font-size: 14px;
87
+ }
88
+
89
+ .formio-error-wrapper {
90
+ background-color: $white;
91
+ }
92
+
93
+ button.wcl-cta,
94
+ button.btn-primary.btn-wizard-nav-next,
95
+ button.btn-primary.btn-wizard-nav-previous,
96
+ button.btn-wizard-nav-submit {
97
+ background: $orange;
98
+ color: $black;
99
+ position: relative;
100
+ text-decoration: none;
101
+ border-radius: $button-base-unit;
102
+ display: inline-flex;
103
+ caret-color: transparent;
104
+ font-size: $button-base-unit * 2;
105
+ font-style: normal;
106
+ font-weight: 700;
107
+ line-height: 20px;
108
+ letter-spacing: 0px;
109
+ padding-top: ($button-base-unit * 2) + 1;
110
+ padding-bottom: ($button-base-unit * 2) - 1;
111
+ padding-left: $button-base-unit * 2;
112
+ padding-right: $button-base-unit * 2;
113
+ border: none;
114
+ margin-bottom: $button-base-unit * 2;
115
+
116
+ &:disabled,
117
+ &:hover {
118
+ color: $black;
119
+ background-color: $orange;
120
+ border-color: transparent;
121
+ }
122
+
123
+ &:after {
124
+ content: arrow-right();
125
+ margin-left: 16px;
126
+ }
127
+ }
128
+
129
+ button.btn-primary.btn-wizard-nav-previous {
130
+ &:after {
131
+ content: none;
132
+ margin-left: 0;
133
+ }
134
+ &:before {
135
+ content: arrow-left();
136
+ margin-right: 16px;
137
+ }
138
+ }
139
+
140
+ .formio-component-email {
141
+
142
+ &:before {
143
+ content: url(../../../assets/icons/Email-circle-black.svg);
144
+ vertical-align: bottom;
145
+ width: 24px;
146
+ height: 24px;
147
+ margin-right: 6px;
148
+ }
149
+ }
150
+
151
+ .formio-component-phoneNumber {
152
+
153
+ &:before {
154
+ content: url(../../../assets/icons/Phone-circle-black.svg);
155
+ vertical-align: bottom;
156
+ width: 24px;
157
+ height: 24px;
158
+ margin-right: 6px;
159
+ }
160
+ }
161
+
162
+ .info {
163
+ vertical-align: -webkit-baseline-middle;
164
+ vertical-align: middle;
165
+ &:before {
166
+ content: url(../../../assets/icons/Info-circle-fill.svg);
167
+ vertical-align: top !important;
168
+ width: 24px;
169
+ height: 24px;
170
+ margin-right: 6px;
171
+
172
+ }
173
+ }
@@ -0,0 +1,255 @@
1
+ import json from '../stories/mocks/address.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'address'
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
+ customConditional:
16
+ "show = _.get(instance, 'parent.manualMode', false);",
17
+ input: true,
18
+ key: 'address',
19
+ label: 'Address',
20
+ tableView: false,
21
+ type: 'textfield'
22
+ },
23
+ {
24
+ customConditional:
25
+ "show = _.get(instance, 'parent.manualMode', false);",
26
+ input: true,
27
+ key: 'address_2',
28
+ label: 'Address 2',
29
+ tableView: false,
30
+ type: 'textfield'
31
+ },
32
+ {
33
+ customConditional:
34
+ "show = _.get(instance, 'parent.manualMode', false);",
35
+ input: true,
36
+ key: 'city',
37
+ label: 'Suburb',
38
+ tableView: false,
39
+ type: 'textfield'
40
+ },
41
+ {
42
+ customConditional:
43
+ "show = _.get(instance, 'parent.manualMode', false);",
44
+ input: true,
45
+ key: 'state_province',
46
+ label: 'State',
47
+ tableView: false,
48
+ type: 'textfield'
49
+ },
50
+ {
51
+ customConditional:
52
+ "show = _.get(instance, 'parent.manualMode', false);",
53
+ input: true,
54
+ key: 'postal_code',
55
+ label: 'Postcode',
56
+ tableView: false,
57
+ type: 'textfield'
58
+ },
59
+ {
60
+ customConditional:
61
+ "show = _.get(instance, 'parent.manualMode', false);",
62
+ input: true,
63
+ key: 'country',
64
+ label: 'Country',
65
+ tableView: false,
66
+ type: 'textfield'
67
+ }
68
+ ],
69
+ customClass: 'custom-formio-1',
70
+ defaultValue: {
71
+ address: '',
72
+ address_2: '',
73
+ city: '',
74
+ country: '',
75
+ postal_code: '',
76
+ state_province: ''
77
+ },
78
+ disabled: false,
79
+ enableManualMode: true,
80
+ hideLabel: true,
81
+ id: 'kitchen_sink_formio_v1--address1',
82
+ input: true,
83
+ key: 'address1',
84
+ label: 'address1',
85
+ mask: false,
86
+ provider: 'custom',
87
+ providerOptions: {
88
+ displayValueProperty: 'description',
89
+ params: { components: 'country:au', types: 'address' },
90
+ queryProperty: 'input',
91
+ responseProperty: 'predictions',
92
+ url: 'http://localhost/places/api/v1/place/autocomplete/json'
93
+ },
94
+ switchToManualModeLabel: "Can't find address? Switch to manual mode.",
95
+ type: 'address',
96
+ validate: { required: false }
97
+ }
98
+ ])
99
+ )
100
+ })
101
+
102
+ it(`should return a submission value for manual mode`, () => {
103
+ const submission = FormTestUtils.handleSubmission(json, {
104
+ mode: 'manual',
105
+ address: {
106
+ address: 'a1',
107
+ address_2: 'sd',
108
+ city: 'sd',
109
+ state_province: 'sd',
110
+ postal_code: 'sd',
111
+ country: 'sds'
112
+ }
113
+ })
114
+ expect(submission).toEqual({
115
+ address1: {
116
+ address: 'a1',
117
+ address_2: 'sd',
118
+ city: 'sd',
119
+ country: 'sds',
120
+ postal_code: 'sd',
121
+ state_province: 'sd'
122
+ }
123
+ })
124
+ })
125
+
126
+ it(`should return a submission value for api mode`, () => {
127
+ const submission = FormTestUtils.handleSubmission(json, {
128
+ mode: 'autocomplete',
129
+ address: {
130
+ description: '715 Sydney Rd, Brunswick VIC 3056, Australia',
131
+ matched_substrings: [
132
+ {
133
+ length: 3,
134
+ offset: 0
135
+ },
136
+ {
137
+ length: 3,
138
+ offset: 4
139
+ }
140
+ ],
141
+ place_id: 'ChIJe_yY7VRD1moR4FaCIXpujzc',
142
+ reference: 'ChIJe_yY7VRD1moR4FaCIXpujzc',
143
+ structured_formatting: {
144
+ main_text: '715 Sydney Road',
145
+ main_text_matched_substrings: [
146
+ {
147
+ length: 3,
148
+ offset: 0
149
+ },
150
+ {
151
+ length: 3,
152
+ offset: 4
153
+ }
154
+ ],
155
+ secondary_text: 'Brunswick VIC, Australia'
156
+ },
157
+ terms: [
158
+ {
159
+ offset: 0,
160
+ value: '715'
161
+ },
162
+ {
163
+ offset: 4,
164
+ value: 'Sydney Road'
165
+ },
166
+ {
167
+ offset: 17,
168
+ value: 'Brunswick'
169
+ },
170
+ {
171
+ offset: 27,
172
+ value: 'VIC'
173
+ },
174
+ {
175
+ offset: 32,
176
+ value: 'Australia'
177
+ }
178
+ ],
179
+ types: ['street_address', 'geocode']
180
+ },
181
+ geocode: {
182
+ address_components: [
183
+ {
184
+ long_name: '715',
185
+ short_name: '715',
186
+ types: ['street_number']
187
+ },
188
+ {
189
+ long_name: 'Sydney Road',
190
+ short_name: 'Sydney Rd',
191
+ types: ['route']
192
+ },
193
+ {
194
+ long_name: 'Brunswick',
195
+ short_name: 'Brunswick',
196
+ types: ['locality', 'political']
197
+ },
198
+ {
199
+ long_name: 'Moreland City',
200
+ short_name: 'Moreland',
201
+ types: ['administrative_area_level_2', 'political']
202
+ },
203
+ {
204
+ long_name: 'Victoria',
205
+ short_name: 'VIC',
206
+ types: ['administrative_area_level_1', 'political']
207
+ },
208
+ {
209
+ long_name: 'Australia',
210
+ short_name: 'AU',
211
+ types: ['country', 'political']
212
+ },
213
+ {
214
+ long_name: '3056',
215
+ short_name: '3056',
216
+ types: ['postal_code']
217
+ }
218
+ ],
219
+ formatted_address: '715 Sydney Rd, Brunswick VIC 3056, Australia',
220
+ geometry: {
221
+ location: {
222
+ lat: -37.7598676,
223
+ lng: 144.9631721
224
+ },
225
+ location_type: 'ROOFTOP',
226
+ viewport: {
227
+ northeast: {
228
+ lat: -37.75852881970849,
229
+ lng: 144.9646129302915
230
+ },
231
+ southwest: {
232
+ lat: -37.76122678029149,
233
+ lng: 144.9619149697085
234
+ }
235
+ }
236
+ },
237
+ place_id: 'ChIJe_yY7VRD1moR4FaCIXpujzc',
238
+ plus_code: {
239
+ compound_code: '6XR7+37 Brunswick VIC, Australia',
240
+ global_code: '4RJ66XR7+37'
241
+ },
242
+ types: ['street_address']
243
+ }
244
+ })
245
+ expect(submission).toEqual({
246
+ address1: {
247
+ address: '715 Sydney Road',
248
+ city: 'Brunswick',
249
+ country: 'Australia',
250
+ postal_code: '3056',
251
+ state_province: 'Victoria'
252
+ }
253
+ })
254
+ })
255
+ })
@@ -0,0 +1,31 @@
1
+ import json from '../stories/mocks/advancedhtml.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'advanced html'
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
+ content: '<h2>Advanced HTML Heading 2</h2><p>para</p>',
14
+ customClass: 'custom-formio-1',
15
+ disabled: false,
16
+ hideLabel: true,
17
+ id: 'kitchen_sink_formio_v1--processed_text',
18
+ input: false,
19
+ key: 'processed_text',
20
+ label: null,
21
+ labelPosition: 'top',
22
+ mask: false,
23
+ refreshOnChange: false,
24
+ tag: 'div',
25
+ type: 'htmlelement',
26
+ validate: { required: false }
27
+ }
28
+ ])
29
+ )
30
+ })
31
+ })
@@ -0,0 +1,38 @@
1
+ import json from '../stories/mocks/autocomplete.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'autocomplete'
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
+ url:
16
+ '/api/v2/search-content?rows=3&field_language=8671&_format=json'
17
+ },
18
+ dataSrc: 'url',
19
+ disabled: false,
20
+ hideLabel: false,
21
+ id: 'kitchen_sink_formio_v1--autocomplete1',
22
+ input: true,
23
+ key: 'autocomplete1',
24
+ label: 'autocomplete - search worksafe content api',
25
+ labelPosition: 'top',
26
+ lazyLoad: true,
27
+ mask: false,
28
+ searchField: 'query',
29
+ selectValues: 'results',
30
+ template: '<span>{{ item.hero_header_title}}</span>',
31
+ type: 'select',
32
+ validate: { maxLength: 255, required: false },
33
+ valueProperty: 'hero_header_title'
34
+ }
35
+ ])
36
+ )
37
+ })
38
+ })
@@ -0,0 +1,31 @@
1
+ import json from '../stories/mocks/basichtml.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'basic html'
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
+ content: '<h2>Basic HTML Heading 2</h2><p>123</p>',
14
+ customClass: 'custom-formio-1',
15
+ disabled: false,
16
+ hideLabel: true,
17
+ id: 'kitchen_sink_formio_v1--markup1',
18
+ input: false,
19
+ key: 'markup1',
20
+ label: null,
21
+ labelPosition: 'top',
22
+ mask: false,
23
+ refreshOnChange: false,
24
+ tag: 'div',
25
+ type: 'htmlelement',
26
+ validate: { required: false }
27
+ }
28
+ ])
29
+ )
30
+ })
31
+ })
@@ -0,0 +1,29 @@
1
+ import json from '../stories/mocks/checkbox.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'checkbox'
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: true,
15
+ disabled: false,
16
+ hideLabel: false,
17
+ id: 'kitchen_sink_formio_v1--checkbox1',
18
+ input: true,
19
+ key: 'checkbox1',
20
+ label: 'checkbox1',
21
+ labelPosition: 'bottom',
22
+ mask: false,
23
+ type: 'checkbox',
24
+ validate: { required: false }
25
+ }
26
+ ])
27
+ )
28
+ })
29
+ })
@@ -0,0 +1,44 @@
1
+ import json from '../stories/mocks/checkboxes.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'checkboxes'
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
+ disabled: false,
16
+ hideLabel: false,
17
+ id: 'kitchen_sink_formio_v1--checkboxes1',
18
+ inline: true,
19
+ input: true,
20
+ inputType: 'checkbox',
21
+ key: 'checkboxes1',
22
+ label: 'checkboxes1',
23
+ labelPosition: 'top',
24
+ mask: false,
25
+ optionsLabelPosition: 'right',
26
+ type: 'selectboxes',
27
+ validate: { required: false },
28
+ values: [
29
+ { label: 'l1', value: 'value1' },
30
+ { label: 'value2', value: 'value2' }
31
+ ]
32
+ }
33
+ ])
34
+ )
35
+ })
36
+
37
+ it(`should return a submission value`, () => {
38
+ const submission = FormTestUtils.handleSubmission(json, {
39
+ value1: false,
40
+ value2: true
41
+ })
42
+ expect(submission).toEqual({ checkboxes1: ['value2'] })
43
+ })
44
+ })
@@ -0,0 +1,91 @@
1
+ import json from '../stories/mocks/checkboxesother.json'
2
+ import { FormTestUtils } from './form-test-utils'
3
+
4
+ const testComponent = 'checkboxes other'
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
+ defaultValue: {},
21
+ disabled: false,
22
+ hideLabel: true,
23
+ id: 0,
24
+ inline: false,
25
+ input: true,
26
+ inputType: 'checkbox',
27
+ key: 0,
28
+ label: 'enter a number',
29
+ mask: false,
30
+ optionsLabelPosition: 'right',
31
+ type: 'selectboxes',
32
+ validate: { required: false },
33
+ values: [
34
+ { label: 1, value: '1'},
35
+ { label: 21, value: '21' },
36
+ { label: 'Other…', value: '_other_' }
37
+ ]
38
+ }
39
+ ],
40
+ width: 12
41
+ },
42
+ {
43
+ components: [
44
+ {
45
+ attributes: { counter: 4 },
46
+ clearOnHide: true,
47
+ conditional: { eq: '_other_', show: true, when: 0 },
48
+ customClass: 'custom-formio-4',
49
+ decimalLimit: 0,
50
+ delimiter: true,
51
+ disabled: false,
52
+ hideLabel: true,
53
+ id: 0,
54
+ input: true,
55
+ inputFormat: 'plain',
56
+ key: 0,
57
+ label: 'Enter other…',
58
+ mask: false,
59
+ placeholder: 'Enter other…',
60
+ requireDecimal: false,
61
+ truncateMultipleSpaces: true,
62
+ type: 'number',
63
+ validate: { required: false }
64
+ }
65
+ ],
66
+ width: 12
67
+ }
68
+ ],
69
+ customClass: 'custom-formio-1',
70
+ defaultValue: {
71
+ checkboxes: {
72
+ content: '[]',
73
+ headers: { 'Content-Type': 'application/json; type=' }
74
+ },
75
+ other: null
76
+ },
77
+ disabled: false,
78
+ hideLabel: true,
79
+ id: 'kitchen_sink_formio_v1--co1',
80
+ input: false,
81
+ key: 'co1',
82
+ label: 'enter a number',
83
+ labelPosition: 'top',
84
+ mask: false,
85
+ type: 'columns',
86
+ validate: {}
87
+ }
88
+ ])
89
+ )
90
+ })
91
+ })