@pie-lib/config-ui 11.9.24 → 11.10.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -115
- package/NEXT.CHANGELOG.json +1 -0
- package/lib/alert-dialog.js +38 -7
- package/lib/alert-dialog.js.map +1 -1
- package/lib/checkbox.js +6 -1
- package/lib/checkbox.js.map +1 -1
- package/lib/choice-configuration/index.js +19 -8
- package/lib/choice-configuration/index.js.map +1 -1
- package/lib/feedback-config/feedback-selector.js +0 -0
- package/lib/inputs.js +8 -2
- package/lib/inputs.js.map +1 -1
- package/lib/layout/config-layout.js +27 -10
- package/lib/layout/config-layout.js.map +1 -1
- package/lib/number-text-field-custom.js +134 -43
- package/lib/number-text-field-custom.js.map +1 -1
- package/lib/number-text-field.js +17 -18
- package/lib/number-text-field.js.map +1 -1
- package/lib/radio-with-label.js +9 -1
- package/lib/radio-with-label.js.map +1 -1
- package/lib/settings/index.js +3 -1
- package/lib/settings/index.js.map +1 -1
- package/lib/settings/panel.js +7 -4
- package/lib/settings/panel.js.map +1 -1
- package/lib/settings/settings-radio-label.js +9 -1
- package/lib/settings/settings-radio-label.js.map +1 -1
- package/lib/settings/toggle.js +18 -0
- package/lib/settings/toggle.js.map +1 -1
- package/package.json +8 -5
- package/src/__tests__/__snapshots__/langs.test.jsx.snap +32 -0
- package/src/__tests__/__snapshots__/settings-panel.test.js.snap +115 -0
- package/src/__tests__/__snapshots__/two-choice.test.js.snap +171 -0
- package/src/__tests__/choice-utils.test.js +12 -0
- package/src/__tests__/langs.test.jsx +37 -0
- package/src/__tests__/number-text-field.test.jsx +148 -0
- package/src/__tests__/settings-panel.test.js +204 -0
- package/src/__tests__/two-choice.test.js +24 -0
- package/src/alert-dialog.jsx +27 -7
- package/src/checkbox.jsx +8 -1
- package/src/choice-configuration/__tests__/__snapshots__/feedback-menu.test.jsx.snap +51 -0
- package/src/choice-configuration/__tests__/__snapshots__/index.test.jsx.snap +519 -0
- package/src/choice-configuration/__tests__/feedback-menu.test.jsx +10 -0
- package/src/choice-configuration/__tests__/index.test.jsx +92 -0
- package/src/choice-configuration/index.jsx +14 -3
- package/src/feedback-config/__tests__/__snapshots__/feedback-config.test.jsx.snap +27 -0
- package/src/feedback-config/__tests__/__snapshots__/feedback-selector.test.jsx.snap +38 -0
- package/src/feedback-config/__tests__/feedback-config.test.jsx +71 -0
- package/src/feedback-config/__tests__/feedback-selector.test.jsx +60 -0
- package/src/feedback-config/feedback-selector.jsx +0 -0
- package/src/inputs.jsx +9 -2
- package/src/layout/__tests__/__snapshots__/config.layout.test.jsx.snap +59 -0
- package/src/layout/__tests__/config.layout.test.jsx +42 -0
- package/src/layout/__tests__/layout-content.test.jsx +3 -0
- package/src/layout/config-layout.jsx +16 -8
- package/src/number-text-field-custom.jsx +86 -28
- package/src/number-text-field.jsx +6 -5
- package/src/radio-with-label.jsx +6 -2
- package/src/settings/index.js +2 -1
- package/src/settings/panel.jsx +5 -2
- package/src/settings/settings-radio-label.jsx +6 -2
- package/src/settings/toggle.jsx +20 -2
- package/src/tags-input/__tests__/__snapshots__/index.test.jsx.snap +170 -0
- package/src/tags-input/__tests__/index.test.jsx +62 -0
- package/README.md +0 -12
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`feedback-menu renders correctly 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
onClick={[Function]}
|
|
7
|
+
>
|
|
8
|
+
<button
|
|
9
|
+
aria-label="Feedback disabled"
|
|
10
|
+
className="MuiButtonBase-root-7 MuiIconButton-root-1"
|
|
11
|
+
disabled={false}
|
|
12
|
+
onBlur={[Function]}
|
|
13
|
+
onContextMenu={[Function]}
|
|
14
|
+
onFocus={[Function]}
|
|
15
|
+
onKeyDown={[Function]}
|
|
16
|
+
onKeyUp={[Function]}
|
|
17
|
+
onMouseDown={[Function]}
|
|
18
|
+
onMouseLeave={[Function]}
|
|
19
|
+
onMouseUp={[Function]}
|
|
20
|
+
onTouchEnd={[Function]}
|
|
21
|
+
onTouchMove={[Function]}
|
|
22
|
+
onTouchStart={[Function]}
|
|
23
|
+
tabIndex="0"
|
|
24
|
+
type="button"
|
|
25
|
+
>
|
|
26
|
+
<span
|
|
27
|
+
className="MuiIconButton-label-6"
|
|
28
|
+
>
|
|
29
|
+
<svg
|
|
30
|
+
aria-hidden="true"
|
|
31
|
+
className="MuiSvgIcon-root-10 MuiSvgIcon-colorDisabled-15"
|
|
32
|
+
focusable="false"
|
|
33
|
+
role="presentation"
|
|
34
|
+
viewBox="0 0 24 24"
|
|
35
|
+
>
|
|
36
|
+
<path
|
|
37
|
+
d="M0 0h24v24H0z"
|
|
38
|
+
fill="none"
|
|
39
|
+
/>
|
|
40
|
+
<path
|
|
41
|
+
d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"
|
|
42
|
+
/>
|
|
43
|
+
</svg>
|
|
44
|
+
</span>
|
|
45
|
+
<span
|
|
46
|
+
className="MuiTouchRipple-root-23"
|
|
47
|
+
/>
|
|
48
|
+
</button>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
`;
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`index - snapshot renders correctly when delete is not allowed 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
className="choiceConfiguration"
|
|
6
|
+
>
|
|
7
|
+
<div>
|
|
8
|
+
<div
|
|
9
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4"
|
|
10
|
+
>
|
|
11
|
+
<label
|
|
12
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
13
|
+
data-shrink={true}
|
|
14
|
+
>
|
|
15
|
+
Correct
|
|
16
|
+
</label>
|
|
17
|
+
<span
|
|
18
|
+
aria-label="Correct"
|
|
19
|
+
className="MuiButtonBase-root-43 MuiIconButton-root-37 MuiPrivateSwitchBase-root-33 MuiRadio-root-28 MuiRadio-colorSecondary-32 RawInputRadio-radioRoot-1 RawInputRadio-customColor-3"
|
|
20
|
+
onBlur={[Function]}
|
|
21
|
+
onContextMenu={[Function]}
|
|
22
|
+
onFocus={[Function]}
|
|
23
|
+
onKeyDown={[Function]}
|
|
24
|
+
onKeyUp={[Function]}
|
|
25
|
+
onMouseDown={[Function]}
|
|
26
|
+
onMouseLeave={[Function]}
|
|
27
|
+
onMouseUp={[Function]}
|
|
28
|
+
onTouchEnd={[Function]}
|
|
29
|
+
onTouchMove={[Function]}
|
|
30
|
+
onTouchStart={[Function]}
|
|
31
|
+
tabIndex={null}
|
|
32
|
+
>
|
|
33
|
+
<span
|
|
34
|
+
className="MuiIconButton-label-42"
|
|
35
|
+
>
|
|
36
|
+
<svg
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
className="MuiSvgIcon-root-46"
|
|
39
|
+
focusable="false"
|
|
40
|
+
role="presentation"
|
|
41
|
+
viewBox="0 0 24 24"
|
|
42
|
+
>
|
|
43
|
+
<path
|
|
44
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
45
|
+
/>
|
|
46
|
+
</svg>
|
|
47
|
+
<input
|
|
48
|
+
checked={false}
|
|
49
|
+
className="MuiPrivateSwitchBase-input-36"
|
|
50
|
+
disabled={false}
|
|
51
|
+
onChange={[Function]}
|
|
52
|
+
type="radio"
|
|
53
|
+
/>
|
|
54
|
+
</span>
|
|
55
|
+
<span
|
|
56
|
+
className="MuiTouchRipple-root-64"
|
|
57
|
+
/>
|
|
58
|
+
</span>
|
|
59
|
+
</div>
|
|
60
|
+
<div>
|
|
61
|
+
<div
|
|
62
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4 Component-labelContainer-55"
|
|
63
|
+
>
|
|
64
|
+
<label
|
|
65
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
66
|
+
data-shrink={true}
|
|
67
|
+
>
|
|
68
|
+
Label
|
|
69
|
+
</label>
|
|
70
|
+
<div
|
|
71
|
+
className="Component-editorHolder-56"
|
|
72
|
+
>
|
|
73
|
+
<div />
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
<div
|
|
77
|
+
className="Component-feedbackContainer-58"
|
|
78
|
+
>
|
|
79
|
+
<svg
|
|
80
|
+
aria-hidden="true"
|
|
81
|
+
className="MuiSvgIcon-root-46 Component-arrowIcon-59"
|
|
82
|
+
focusable="false"
|
|
83
|
+
role="presentation"
|
|
84
|
+
viewBox="0 0 24 24"
|
|
85
|
+
>
|
|
86
|
+
<path
|
|
87
|
+
d="M0 0h24v24H0V0z"
|
|
88
|
+
fill="none"
|
|
89
|
+
/>
|
|
90
|
+
<path
|
|
91
|
+
d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z"
|
|
92
|
+
/>
|
|
93
|
+
</svg>
|
|
94
|
+
<div
|
|
95
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4 Component-labelContainer-55 Component-text-57"
|
|
96
|
+
>
|
|
97
|
+
<label
|
|
98
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
99
|
+
data-shrink={true}
|
|
100
|
+
>
|
|
101
|
+
Feedback Text
|
|
102
|
+
</label>
|
|
103
|
+
<div
|
|
104
|
+
className="Component-editorHolder-56"
|
|
105
|
+
>
|
|
106
|
+
<div />
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
<div
|
|
112
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4"
|
|
113
|
+
>
|
|
114
|
+
<label
|
|
115
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
116
|
+
data-shrink={true}
|
|
117
|
+
>
|
|
118
|
+
Feedback
|
|
119
|
+
</label>
|
|
120
|
+
<div>
|
|
121
|
+
<div
|
|
122
|
+
onClick={[Function]}
|
|
123
|
+
>
|
|
124
|
+
<button
|
|
125
|
+
aria-label="Custom Feedback"
|
|
126
|
+
className="MuiButtonBase-root-43 MuiIconButton-root-37"
|
|
127
|
+
disabled={false}
|
|
128
|
+
onBlur={[Function]}
|
|
129
|
+
onContextMenu={[Function]}
|
|
130
|
+
onFocus={[Function]}
|
|
131
|
+
onKeyDown={[Function]}
|
|
132
|
+
onKeyUp={[Function]}
|
|
133
|
+
onMouseDown={[Function]}
|
|
134
|
+
onMouseLeave={[Function]}
|
|
135
|
+
onMouseUp={[Function]}
|
|
136
|
+
onTouchEnd={[Function]}
|
|
137
|
+
onTouchMove={[Function]}
|
|
138
|
+
onTouchStart={[Function]}
|
|
139
|
+
tabIndex="0"
|
|
140
|
+
type="button"
|
|
141
|
+
>
|
|
142
|
+
<span
|
|
143
|
+
className="MuiIconButton-label-42"
|
|
144
|
+
>
|
|
145
|
+
<svg
|
|
146
|
+
aria-hidden="true"
|
|
147
|
+
className="MuiSvgIcon-root-46 MuiSvgIcon-colorPrimary-47"
|
|
148
|
+
focusable="false"
|
|
149
|
+
role="presentation"
|
|
150
|
+
viewBox="0 0 24 24"
|
|
151
|
+
>
|
|
152
|
+
<path
|
|
153
|
+
d="M0 0h24v24H0z"
|
|
154
|
+
fill="none"
|
|
155
|
+
/>
|
|
156
|
+
<path
|
|
157
|
+
d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"
|
|
158
|
+
/>
|
|
159
|
+
</svg>
|
|
160
|
+
</span>
|
|
161
|
+
<span
|
|
162
|
+
className="MuiTouchRipple-root-64"
|
|
163
|
+
/>
|
|
164
|
+
</button>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
`;
|
|
171
|
+
|
|
172
|
+
exports[`index - snapshot renders correctly when feedback is not allowed 1`] = `
|
|
173
|
+
<div
|
|
174
|
+
className="choiceConfiguration"
|
|
175
|
+
>
|
|
176
|
+
<div>
|
|
177
|
+
<div
|
|
178
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4"
|
|
179
|
+
>
|
|
180
|
+
<label
|
|
181
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
182
|
+
data-shrink={true}
|
|
183
|
+
>
|
|
184
|
+
Correct
|
|
185
|
+
</label>
|
|
186
|
+
<span
|
|
187
|
+
aria-label="Correct"
|
|
188
|
+
className="MuiButtonBase-root-43 MuiIconButton-root-37 MuiPrivateSwitchBase-root-33 MuiRadio-root-28 MuiRadio-colorSecondary-32 RawInputRadio-radioRoot-1 RawInputRadio-customColor-3"
|
|
189
|
+
onBlur={[Function]}
|
|
190
|
+
onContextMenu={[Function]}
|
|
191
|
+
onFocus={[Function]}
|
|
192
|
+
onKeyDown={[Function]}
|
|
193
|
+
onKeyUp={[Function]}
|
|
194
|
+
onMouseDown={[Function]}
|
|
195
|
+
onMouseLeave={[Function]}
|
|
196
|
+
onMouseUp={[Function]}
|
|
197
|
+
onTouchEnd={[Function]}
|
|
198
|
+
onTouchMove={[Function]}
|
|
199
|
+
onTouchStart={[Function]}
|
|
200
|
+
tabIndex={null}
|
|
201
|
+
>
|
|
202
|
+
<span
|
|
203
|
+
className="MuiIconButton-label-42"
|
|
204
|
+
>
|
|
205
|
+
<svg
|
|
206
|
+
aria-hidden="true"
|
|
207
|
+
className="MuiSvgIcon-root-46"
|
|
208
|
+
focusable="false"
|
|
209
|
+
role="presentation"
|
|
210
|
+
viewBox="0 0 24 24"
|
|
211
|
+
>
|
|
212
|
+
<path
|
|
213
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
214
|
+
/>
|
|
215
|
+
</svg>
|
|
216
|
+
<input
|
|
217
|
+
checked={false}
|
|
218
|
+
className="MuiPrivateSwitchBase-input-36"
|
|
219
|
+
disabled={false}
|
|
220
|
+
onChange={[Function]}
|
|
221
|
+
type="radio"
|
|
222
|
+
/>
|
|
223
|
+
</span>
|
|
224
|
+
<span
|
|
225
|
+
className="MuiTouchRipple-root-64"
|
|
226
|
+
/>
|
|
227
|
+
</span>
|
|
228
|
+
</div>
|
|
229
|
+
<div>
|
|
230
|
+
<div
|
|
231
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4 Component-labelContainer-55"
|
|
232
|
+
>
|
|
233
|
+
<label
|
|
234
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
235
|
+
data-shrink={true}
|
|
236
|
+
>
|
|
237
|
+
Label
|
|
238
|
+
</label>
|
|
239
|
+
<div
|
|
240
|
+
className="Component-editorHolder-56"
|
|
241
|
+
>
|
|
242
|
+
<div />
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
<div
|
|
247
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4"
|
|
248
|
+
>
|
|
249
|
+
<label
|
|
250
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
251
|
+
data-shrink={true}
|
|
252
|
+
>
|
|
253
|
+
Delete
|
|
254
|
+
</label>
|
|
255
|
+
<button
|
|
256
|
+
aria-label="delete"
|
|
257
|
+
className="MuiButtonBase-root-43 MuiIconButton-root-37"
|
|
258
|
+
disabled={false}
|
|
259
|
+
onBlur={[Function]}
|
|
260
|
+
onContextMenu={[Function]}
|
|
261
|
+
onFocus={[Function]}
|
|
262
|
+
onKeyDown={[Function]}
|
|
263
|
+
onKeyUp={[Function]}
|
|
264
|
+
onMouseDown={[Function]}
|
|
265
|
+
onMouseLeave={[Function]}
|
|
266
|
+
onMouseUp={[Function]}
|
|
267
|
+
onTouchEnd={[Function]}
|
|
268
|
+
onTouchMove={[Function]}
|
|
269
|
+
onTouchStart={[Function]}
|
|
270
|
+
tabIndex="0"
|
|
271
|
+
type="button"
|
|
272
|
+
>
|
|
273
|
+
<span
|
|
274
|
+
className="MuiIconButton-label-42"
|
|
275
|
+
>
|
|
276
|
+
<svg
|
|
277
|
+
aria-hidden="true"
|
|
278
|
+
className="MuiSvgIcon-root-46"
|
|
279
|
+
focusable="false"
|
|
280
|
+
role="presentation"
|
|
281
|
+
viewBox="0 0 24 24"
|
|
282
|
+
>
|
|
283
|
+
<path
|
|
284
|
+
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
|
285
|
+
/>
|
|
286
|
+
<path
|
|
287
|
+
d="M0 0h24v24H0z"
|
|
288
|
+
fill="none"
|
|
289
|
+
/>
|
|
290
|
+
</svg>
|
|
291
|
+
</span>
|
|
292
|
+
<span
|
|
293
|
+
className="MuiTouchRipple-root-64"
|
|
294
|
+
/>
|
|
295
|
+
</button>
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
`;
|
|
300
|
+
|
|
301
|
+
exports[`index - snapshot renders correctly with default props 1`] = `
|
|
302
|
+
<div
|
|
303
|
+
className="choiceConfiguration"
|
|
304
|
+
>
|
|
305
|
+
<div>
|
|
306
|
+
<div
|
|
307
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4"
|
|
308
|
+
>
|
|
309
|
+
<label
|
|
310
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
311
|
+
data-shrink={true}
|
|
312
|
+
>
|
|
313
|
+
Correct
|
|
314
|
+
</label>
|
|
315
|
+
<span
|
|
316
|
+
aria-label="Correct"
|
|
317
|
+
className="MuiButtonBase-root-43 MuiIconButton-root-37 MuiPrivateSwitchBase-root-33 MuiRadio-root-28 MuiRadio-colorSecondary-32 RawInputRadio-radioRoot-1 RawInputRadio-customColor-3"
|
|
318
|
+
onBlur={[Function]}
|
|
319
|
+
onContextMenu={[Function]}
|
|
320
|
+
onFocus={[Function]}
|
|
321
|
+
onKeyDown={[Function]}
|
|
322
|
+
onKeyUp={[Function]}
|
|
323
|
+
onMouseDown={[Function]}
|
|
324
|
+
onMouseLeave={[Function]}
|
|
325
|
+
onMouseUp={[Function]}
|
|
326
|
+
onTouchEnd={[Function]}
|
|
327
|
+
onTouchMove={[Function]}
|
|
328
|
+
onTouchStart={[Function]}
|
|
329
|
+
tabIndex={null}
|
|
330
|
+
>
|
|
331
|
+
<span
|
|
332
|
+
className="MuiIconButton-label-42"
|
|
333
|
+
>
|
|
334
|
+
<svg
|
|
335
|
+
aria-hidden="true"
|
|
336
|
+
className="MuiSvgIcon-root-46"
|
|
337
|
+
focusable="false"
|
|
338
|
+
role="presentation"
|
|
339
|
+
viewBox="0 0 24 24"
|
|
340
|
+
>
|
|
341
|
+
<path
|
|
342
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
343
|
+
/>
|
|
344
|
+
</svg>
|
|
345
|
+
<input
|
|
346
|
+
checked={false}
|
|
347
|
+
className="MuiPrivateSwitchBase-input-36"
|
|
348
|
+
disabled={false}
|
|
349
|
+
onChange={[Function]}
|
|
350
|
+
type="radio"
|
|
351
|
+
/>
|
|
352
|
+
</span>
|
|
353
|
+
<span
|
|
354
|
+
className="MuiTouchRipple-root-64"
|
|
355
|
+
/>
|
|
356
|
+
</span>
|
|
357
|
+
</div>
|
|
358
|
+
<div>
|
|
359
|
+
<div
|
|
360
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4 Component-labelContainer-55"
|
|
361
|
+
>
|
|
362
|
+
<label
|
|
363
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
364
|
+
data-shrink={true}
|
|
365
|
+
>
|
|
366
|
+
Label
|
|
367
|
+
</label>
|
|
368
|
+
<div
|
|
369
|
+
className="Component-editorHolder-56"
|
|
370
|
+
>
|
|
371
|
+
<div />
|
|
372
|
+
</div>
|
|
373
|
+
</div>
|
|
374
|
+
<div
|
|
375
|
+
className="Component-feedbackContainer-58"
|
|
376
|
+
>
|
|
377
|
+
<svg
|
|
378
|
+
aria-hidden="true"
|
|
379
|
+
className="MuiSvgIcon-root-46 Component-arrowIcon-59"
|
|
380
|
+
focusable="false"
|
|
381
|
+
role="presentation"
|
|
382
|
+
viewBox="0 0 24 24"
|
|
383
|
+
>
|
|
384
|
+
<path
|
|
385
|
+
d="M0 0h24v24H0V0z"
|
|
386
|
+
fill="none"
|
|
387
|
+
/>
|
|
388
|
+
<path
|
|
389
|
+
d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z"
|
|
390
|
+
/>
|
|
391
|
+
</svg>
|
|
392
|
+
<div
|
|
393
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4 Component-labelContainer-55 Component-text-57"
|
|
394
|
+
>
|
|
395
|
+
<label
|
|
396
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
397
|
+
data-shrink={true}
|
|
398
|
+
>
|
|
399
|
+
Feedback Text
|
|
400
|
+
</label>
|
|
401
|
+
<div
|
|
402
|
+
className="Component-editorHolder-56"
|
|
403
|
+
>
|
|
404
|
+
<div />
|
|
405
|
+
</div>
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
<div
|
|
410
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4"
|
|
411
|
+
>
|
|
412
|
+
<label
|
|
413
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
414
|
+
data-shrink={true}
|
|
415
|
+
>
|
|
416
|
+
Feedback
|
|
417
|
+
</label>
|
|
418
|
+
<div>
|
|
419
|
+
<div
|
|
420
|
+
onClick={[Function]}
|
|
421
|
+
>
|
|
422
|
+
<button
|
|
423
|
+
aria-label="Custom Feedback"
|
|
424
|
+
className="MuiButtonBase-root-43 MuiIconButton-root-37"
|
|
425
|
+
disabled={false}
|
|
426
|
+
onBlur={[Function]}
|
|
427
|
+
onContextMenu={[Function]}
|
|
428
|
+
onFocus={[Function]}
|
|
429
|
+
onKeyDown={[Function]}
|
|
430
|
+
onKeyUp={[Function]}
|
|
431
|
+
onMouseDown={[Function]}
|
|
432
|
+
onMouseLeave={[Function]}
|
|
433
|
+
onMouseUp={[Function]}
|
|
434
|
+
onTouchEnd={[Function]}
|
|
435
|
+
onTouchMove={[Function]}
|
|
436
|
+
onTouchStart={[Function]}
|
|
437
|
+
tabIndex="0"
|
|
438
|
+
type="button"
|
|
439
|
+
>
|
|
440
|
+
<span
|
|
441
|
+
className="MuiIconButton-label-42"
|
|
442
|
+
>
|
|
443
|
+
<svg
|
|
444
|
+
aria-hidden="true"
|
|
445
|
+
className="MuiSvgIcon-root-46 MuiSvgIcon-colorPrimary-47"
|
|
446
|
+
focusable="false"
|
|
447
|
+
role="presentation"
|
|
448
|
+
viewBox="0 0 24 24"
|
|
449
|
+
>
|
|
450
|
+
<path
|
|
451
|
+
d="M0 0h24v24H0z"
|
|
452
|
+
fill="none"
|
|
453
|
+
/>
|
|
454
|
+
<path
|
|
455
|
+
d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"
|
|
456
|
+
/>
|
|
457
|
+
</svg>
|
|
458
|
+
</span>
|
|
459
|
+
<span
|
|
460
|
+
className="MuiTouchRipple-root-64"
|
|
461
|
+
/>
|
|
462
|
+
</button>
|
|
463
|
+
</div>
|
|
464
|
+
</div>
|
|
465
|
+
</div>
|
|
466
|
+
<div
|
|
467
|
+
className="MuiFormControl-root-6 RawInputContainer-formControl-4"
|
|
468
|
+
>
|
|
469
|
+
<label
|
|
470
|
+
className="MuiFormLabel-root-21 MuiInputLabel-root-10 MuiInputLabel-formControl-15 MuiInputLabel-animated-18 MuiInputLabel-shrink-17 RawInputContainer-label-5"
|
|
471
|
+
data-shrink={true}
|
|
472
|
+
>
|
|
473
|
+
Delete
|
|
474
|
+
</label>
|
|
475
|
+
<button
|
|
476
|
+
aria-label="delete"
|
|
477
|
+
className="MuiButtonBase-root-43 MuiIconButton-root-37"
|
|
478
|
+
disabled={false}
|
|
479
|
+
onBlur={[Function]}
|
|
480
|
+
onContextMenu={[Function]}
|
|
481
|
+
onFocus={[Function]}
|
|
482
|
+
onKeyDown={[Function]}
|
|
483
|
+
onKeyUp={[Function]}
|
|
484
|
+
onMouseDown={[Function]}
|
|
485
|
+
onMouseLeave={[Function]}
|
|
486
|
+
onMouseUp={[Function]}
|
|
487
|
+
onTouchEnd={[Function]}
|
|
488
|
+
onTouchMove={[Function]}
|
|
489
|
+
onTouchStart={[Function]}
|
|
490
|
+
tabIndex="0"
|
|
491
|
+
type="button"
|
|
492
|
+
>
|
|
493
|
+
<span
|
|
494
|
+
className="MuiIconButton-label-42"
|
|
495
|
+
>
|
|
496
|
+
<svg
|
|
497
|
+
aria-hidden="true"
|
|
498
|
+
className="MuiSvgIcon-root-46"
|
|
499
|
+
focusable="false"
|
|
500
|
+
role="presentation"
|
|
501
|
+
viewBox="0 0 24 24"
|
|
502
|
+
>
|
|
503
|
+
<path
|
|
504
|
+
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
|
505
|
+
/>
|
|
506
|
+
<path
|
|
507
|
+
d="M0 0h24v24H0z"
|
|
508
|
+
fill="none"
|
|
509
|
+
/>
|
|
510
|
+
</svg>
|
|
511
|
+
</span>
|
|
512
|
+
<span
|
|
513
|
+
className="MuiTouchRipple-root-64"
|
|
514
|
+
/>
|
|
515
|
+
</button>
|
|
516
|
+
</div>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FeedbackMenu from '../feedback-menu';
|
|
3
|
+
import renderer from 'react-test-renderer';
|
|
4
|
+
|
|
5
|
+
describe('feedback-menu', () => {
|
|
6
|
+
it('renders correctly', () => {
|
|
7
|
+
const tree = renderer.create(<FeedbackMenu onChange={jest.fn()} />).toJSON();
|
|
8
|
+
expect(tree).toMatchSnapshot();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChoiceConfiguration } from '../index';
|
|
3
|
+
import renderer from 'react-test-renderer';
|
|
4
|
+
import { shallow } from 'enzyme';
|
|
5
|
+
import Enzyme from 'enzyme';
|
|
6
|
+
import Adapter from 'enzyme-adapter-react-16';
|
|
7
|
+
|
|
8
|
+
jest.mock('@pie-lib/editable-html', () => () => <div />);
|
|
9
|
+
|
|
10
|
+
Enzyme.configure({ adapter: new Adapter() });
|
|
11
|
+
|
|
12
|
+
const defaultFeedback = {
|
|
13
|
+
correct: 'Correct',
|
|
14
|
+
incorrect: 'Incorrect',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const data = {
|
|
18
|
+
checked: true,
|
|
19
|
+
value: 'foo',
|
|
20
|
+
label: 'Foo',
|
|
21
|
+
feedback: {
|
|
22
|
+
type: 'custom',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const classes = {
|
|
27
|
+
choiceConfiguration: 'choiceConfiguration',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
describe('index - snapshot', () => {
|
|
31
|
+
it('renders correctly with default props', () => {
|
|
32
|
+
const tree = renderer
|
|
33
|
+
.create(<ChoiceConfiguration classes={classes} defaultFeedback={defaultFeedback} data={data} />)
|
|
34
|
+
.toJSON();
|
|
35
|
+
expect(tree).toMatchSnapshot();
|
|
36
|
+
});
|
|
37
|
+
it('renders correctly when feedback is not allowed', () => {
|
|
38
|
+
const tree = renderer
|
|
39
|
+
.create(
|
|
40
|
+
<ChoiceConfiguration allowFeedBack={false} classes={classes} defaultFeedback={defaultFeedback} data={data} />,
|
|
41
|
+
)
|
|
42
|
+
.toJSON();
|
|
43
|
+
expect(tree).toMatchSnapshot();
|
|
44
|
+
});
|
|
45
|
+
it('renders correctly when delete is not allowed', () => {
|
|
46
|
+
const tree = renderer
|
|
47
|
+
.create(
|
|
48
|
+
<ChoiceConfiguration allowDelete={false} classes={classes} defaultFeedback={defaultFeedback} data={data} />,
|
|
49
|
+
)
|
|
50
|
+
.toJSON();
|
|
51
|
+
expect(tree).toMatchSnapshot();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('index - logic', () => {
|
|
56
|
+
let wrapper, instance, onChange;
|
|
57
|
+
|
|
58
|
+
beforeEach(() => {
|
|
59
|
+
onChange = jest.fn();
|
|
60
|
+
|
|
61
|
+
wrapper = shallow(
|
|
62
|
+
<ChoiceConfiguration classes={classes} defaultFeedback={defaultFeedback} data={data} onChange={onChange} />,
|
|
63
|
+
);
|
|
64
|
+
instance = wrapper.instance();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('onCheckedChange', () => {
|
|
68
|
+
it('calls onChange', () => {
|
|
69
|
+
instance.onLabelChange('new label');
|
|
70
|
+
expect(onChange.mock.calls.length).toBe(1);
|
|
71
|
+
expect(onChange.mock.calls[0][0]).toMatchObject({ label: 'new label' });
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('onFeedbackTypeChange', () => {
|
|
76
|
+
it('calls onChange', () => {
|
|
77
|
+
instance.onFeedbackTypeChange('default');
|
|
78
|
+
expect(onChange.mock.calls[0][0]).toMatchObject({
|
|
79
|
+
feedback: { type: 'default' },
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('onFeedbackValueChange', () => {
|
|
85
|
+
it('calls onChange', () => {
|
|
86
|
+
instance.onFeedbackValueChange('new feedback');
|
|
87
|
+
expect(onChange.mock.calls[0][0]).toMatchObject({
|
|
88
|
+
feedback: { value: 'new feedback' },
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|