@wirenboard/json-editor 2.5.3-wb13

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 (283) hide show
  1. package/.env-dist +2 -0
  2. package/.eslintrc +7 -0
  3. package/.gitattributes +1 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +9 -0
  5. package/.github/issue_template +25 -0
  6. package/.github/workflows/build.yml +58 -0
  7. package/.travis.yml +70 -0
  8. package/CHANGELOG.md +915 -0
  9. package/CONTRIBUTING.md +92 -0
  10. package/LICENSE +20 -0
  11. package/Makefile +26 -0
  12. package/README.md +1646 -0
  13. package/README_ADDON.md +573 -0
  14. package/UPGRADING.md +46 -0
  15. package/build/CssToJson.js +55 -0
  16. package/codecept.conf.js +35 -0
  17. package/config/.eslintrc +7 -0
  18. package/config/codeceptjs_helpers.js +139 -0
  19. package/config/helpers.js +10 -0
  20. package/config/karma.conf.js +93 -0
  21. package/config/readme.md +31 -0
  22. package/config/webpack.common.js +75 -0
  23. package/config/webpack.dev.js +15 -0
  24. package/config/webpack.nonmin.js +19 -0
  25. package/config/webpack.prod.js +25 -0
  26. package/dist/jsoneditor.js +14 -0
  27. package/dist/nonmin/jsoneditor.js +29097 -0
  28. package/dist/nonmin/jsoneditor.js.map +1 -0
  29. package/docs/ace_editor.html +56 -0
  30. package/docs/advanced.html +136 -0
  31. package/docs/basic.html +63 -0
  32. package/docs/basic_person.json +26 -0
  33. package/docs/choices.html +86 -0
  34. package/docs/cleave.html +132 -0
  35. package/docs/colorpicker.html +194 -0
  36. package/docs/css_integration.html +135 -0
  37. package/docs/datetime.html +305 -0
  38. package/docs/describedby.html +161 -0
  39. package/docs/enumsource.html +67 -0
  40. package/docs/images/categoriesDemo.png +0 -0
  41. package/docs/images/inheritance_tree.png +0 -0
  42. package/docs/images/jsoneditor.png +0 -0
  43. package/docs/imask.html +192 -0
  44. package/docs/index.html +579 -0
  45. package/docs/materialize_css.html +164 -0
  46. package/docs/meta_schema.json +705 -0
  47. package/docs/multiple_upload_base64.html +65 -0
  48. package/docs/person.json +73 -0
  49. package/docs/polyfills/assign.js +29 -0
  50. package/docs/radio.html +156 -0
  51. package/docs/recursive.html +170 -0
  52. package/docs/select2.html +99 -0
  53. package/docs/selectize.html +100 -0
  54. package/docs/signature.html +42 -0
  55. package/docs/starrating.html +137 -0
  56. package/docs/upload.html +131 -0
  57. package/docs/uuid.html +70 -0
  58. package/docs/wysiwyg.html +56 -0
  59. package/jasmine.json +11 -0
  60. package/json-editor-json-editor-2.5.3-wb13.tgz +0 -0
  61. package/package.json +100 -0
  62. package/release-notes.md +88 -0
  63. package/src/core.js +412 -0
  64. package/src/defaults.js +402 -0
  65. package/src/editor.js +707 -0
  66. package/src/editors/ace.js +89 -0
  67. package/src/editors/array/choices.js +103 -0
  68. package/src/editors/array/select2.js +110 -0
  69. package/src/editors/array/selectize.js +103 -0
  70. package/src/editors/array.css +9 -0
  71. package/src/editors/array.css.js +3 -0
  72. package/src/editors/array.js +818 -0
  73. package/src/editors/autocomplete.js +58 -0
  74. package/src/editors/base64.js +157 -0
  75. package/src/editors/button.js +97 -0
  76. package/src/editors/checkbox.js +95 -0
  77. package/src/editors/choices.css +3 -0
  78. package/src/editors/choices.css.js +3 -0
  79. package/src/editors/choices.js +69 -0
  80. package/src/editors/colorpicker.js +103 -0
  81. package/src/editors/datetime.js +141 -0
  82. package/src/editors/describedby.js +188 -0
  83. package/src/editors/enum.js +136 -0
  84. package/src/editors/hidden.js +127 -0
  85. package/src/editors/index.js +81 -0
  86. package/src/editors/info.js +20 -0
  87. package/src/editors/integer.js +19 -0
  88. package/src/editors/ip.js +36 -0
  89. package/src/editors/jodit.js +64 -0
  90. package/src/editors/multiple.js +409 -0
  91. package/src/editors/multiselect.js +218 -0
  92. package/src/editors/null.js +18 -0
  93. package/src/editors/number.js +51 -0
  94. package/src/editors/object.css +41 -0
  95. package/src/editors/object.css.js +3 -0
  96. package/src/editors/object.js +1290 -0
  97. package/src/editors/radio.js +111 -0
  98. package/src/editors/sceditor.js +72 -0
  99. package/src/editors/select.js +370 -0
  100. package/src/editors/select2.js +110 -0
  101. package/src/editors/selectize.js +112 -0
  102. package/src/editors/signature.js +113 -0
  103. package/src/editors/simplemde.js +100 -0
  104. package/src/editors/starrating.css +52 -0
  105. package/src/editors/starrating.css.js +3 -0
  106. package/src/editors/starrating.js +135 -0
  107. package/src/editors/stepper.js +27 -0
  108. package/src/editors/string.js +372 -0
  109. package/src/editors/table.js +516 -0
  110. package/src/editors/upload.js +321 -0
  111. package/src/editors/uuid.js +56 -0
  112. package/src/iconlib.js +24 -0
  113. package/src/iconlibs/bootstrap2.js +28 -0
  114. package/src/iconlibs/bootstrap3.js +28 -0
  115. package/src/iconlibs/fontawesome3.js +28 -0
  116. package/src/iconlibs/fontawesome4.js +28 -0
  117. package/src/iconlibs/fontawesome5.js +28 -0
  118. package/src/iconlibs/foundation2.js +24 -0
  119. package/src/iconlibs/foundation3.js +28 -0
  120. package/src/iconlibs/index.js +25 -0
  121. package/src/iconlibs/jqueryui.js +28 -0
  122. package/src/iconlibs/materialicons.js +49 -0
  123. package/src/iconlibs/openiconic.js +28 -0
  124. package/src/iconlibs/spectre.js +28 -0
  125. package/src/resolvers.js +128 -0
  126. package/src/schemaloader.js +408 -0
  127. package/src/style.css +150 -0
  128. package/src/style.css.js +3 -0
  129. package/src/templates/default.js +52 -0
  130. package/src/templates/ejs.js +13 -0
  131. package/src/templates/handlebars.js +1 -0
  132. package/src/templates/hogan.js +10 -0
  133. package/src/templates/index.js +21 -0
  134. package/src/templates/lodash.js +9 -0
  135. package/src/templates/markup.js +9 -0
  136. package/src/templates/mustache.js +9 -0
  137. package/src/templates/swig.js +1 -0
  138. package/src/templates/underscore.js +9 -0
  139. package/src/theme.js +659 -0
  140. package/src/themes/barebones.css +35 -0
  141. package/src/themes/barebones.css.js +3 -0
  142. package/src/themes/barebones.js +28 -0
  143. package/src/themes/bootstrap2.js +319 -0
  144. package/src/themes/bootstrap3.css +0 -0
  145. package/src/themes/bootstrap3.css.js +3 -0
  146. package/src/themes/bootstrap3.js +315 -0
  147. package/src/themes/bootstrap4.css +89 -0
  148. package/src/themes/bootstrap4.css.js +3 -0
  149. package/src/themes/bootstrap4.js +690 -0
  150. package/src/themes/bootstrap5.css.js +3 -0
  151. package/src/themes/foundation.js +569 -0
  152. package/src/themes/html.css +60 -0
  153. package/src/themes/html.css.js +3 -0
  154. package/src/themes/html.js +71 -0
  155. package/src/themes/index.js +28 -0
  156. package/src/themes/jqueryui.js +198 -0
  157. package/src/themes/materialize.js +426 -0
  158. package/src/themes/spectre.css +208 -0
  159. package/src/themes/spectre.css.js +3 -0
  160. package/src/themes/spectre.js +406 -0
  161. package/src/themes/tailwind.css +249 -0
  162. package/src/themes/tailwind.css.js +3 -0
  163. package/src/themes/tailwind.js +443 -0
  164. package/src/utilities.js +138 -0
  165. package/src/validator.js +877 -0
  166. package/src/validators/ip-validator.js +51 -0
  167. package/tests/Dockerfile +3 -0
  168. package/tests/README.md +48 -0
  169. package/tests/codeceptjs/codecept.json +42 -0
  170. package/tests/codeceptjs/constrains/if-then-else_test.js +143 -0
  171. package/tests/codeceptjs/core_test.js +217 -0
  172. package/tests/codeceptjs/editors/advanced_test.js +13 -0
  173. package/tests/codeceptjs/editors/array_any_of_test.js +50 -0
  174. package/tests/codeceptjs/editors/array_test.js +900 -0
  175. package/tests/codeceptjs/editors/button_test.js +35 -0
  176. package/tests/codeceptjs/editors/checkbox_test.js +21 -0
  177. package/tests/codeceptjs/editors/colorpicker_test.js +27 -0
  178. package/tests/codeceptjs/editors/datetime_test.js +33 -0
  179. package/tests/codeceptjs/editors/inheritance_test.js +11 -0
  180. package/tests/codeceptjs/editors/integer_test.js +84 -0
  181. package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +32 -0
  182. package/tests/codeceptjs/editors/jodit_test.js +24 -0
  183. package/tests/codeceptjs/editors/multiselect_test.js +8 -0
  184. package/tests/codeceptjs/editors/number_test.js +82 -0
  185. package/tests/codeceptjs/editors/object_test.js +204 -0
  186. package/tests/codeceptjs/editors/option-no_default_values_test.js +42 -0
  187. package/tests/codeceptjs/editors/programmatic-changes_test.js +20 -0
  188. package/tests/codeceptjs/editors/radio_test.js +10 -0
  189. package/tests/codeceptjs/editors/rating_test.js +13 -0
  190. package/tests/codeceptjs/editors/select_test.js +22 -0
  191. package/tests/codeceptjs/editors/stepper_test.js +27 -0
  192. package/tests/codeceptjs/editors/string_test.js +118 -0
  193. package/tests/codeceptjs/editors/table-confirm-delete_test.js +67 -0
  194. package/tests/codeceptjs/editors/tabs_test.js +14 -0
  195. package/tests/codeceptjs/editors/uuid_test.js +21 -0
  196. package/tests/codeceptjs/editors/validation_test.js +14 -0
  197. package/tests/codeceptjs/meta-schema_test.js +17 -0
  198. package/tests/codeceptjs/schemaloader_test.js +13 -0
  199. package/tests/codeceptjs/steps.d.ts +13 -0
  200. package/tests/codeceptjs/steps_file.js +12 -0
  201. package/tests/codeceptjs/themes_test.js +519 -0
  202. package/tests/docker-compose.yml +34 -0
  203. package/tests/fixtures/basic_person.json +26 -0
  204. package/tests/fixtures/nested_object.json +26 -0
  205. package/tests/fixtures/person.json +55 -0
  206. package/tests/fixtures/recursive.json +8 -0
  207. package/tests/fixtures/some_types.json +32 -0
  208. package/tests/fixtures/string.json +3 -0
  209. package/tests/fixtures/validation.json +1140 -0
  210. package/tests/pages/_demo.html +475 -0
  211. package/tests/pages/advanced.html +137 -0
  212. package/tests/pages/anyof.html +80 -0
  213. package/tests/pages/array-anyof.html +142 -0
  214. package/tests/pages/array-checkboxes.html +41 -0
  215. package/tests/pages/array-choices.html +45 -0
  216. package/tests/pages/array-integers.html +37 -0
  217. package/tests/pages/array-move-events.html +61 -0
  218. package/tests/pages/array-multiselects.html +42 -0
  219. package/tests/pages/array-nested-arrays.html +40 -0
  220. package/tests/pages/array-numbers.html +37 -0
  221. package/tests/pages/array-objects.html +42 -0
  222. package/tests/pages/array-ratings.html +40 -0
  223. package/tests/pages/array-selectize.html +51 -0
  224. package/tests/pages/array-selects.html +36 -0
  225. package/tests/pages/array-strings.html +36 -0
  226. package/tests/pages/array.html +42 -0
  227. package/tests/pages/assets/pages.css +130 -0
  228. package/tests/pages/button-callbacks.html +77 -0
  229. package/tests/pages/checkbox-labels.html +114 -0
  230. package/tests/pages/colorpicker-no-3rd-party.html +43 -0
  231. package/tests/pages/colorpicker-use-vanilla-picker.html +50 -0
  232. package/tests/pages/core.html +118 -0
  233. package/tests/pages/datetime.html +76 -0
  234. package/tests/pages/form-name.html +108 -0
  235. package/tests/pages/grid-strict.html +311 -0
  236. package/tests/pages/grid.html +284 -0
  237. package/tests/pages/if-then-else-allOf.html +117 -0
  238. package/tests/pages/inheritance.html +76 -0
  239. package/tests/pages/integer.html +68 -0
  240. package/tests/pages/issues/_template.html +50 -0
  241. package/tests/pages/issues/issue-gh-812.html +110 -0
  242. package/tests/pages/issues/issue-gh-823-meta-schema.html +35 -0
  243. package/tests/pages/issues/issue-gh-848.html +81 -0
  244. package/tests/pages/meta_schema.json +705 -0
  245. package/tests/pages/number.html +89 -0
  246. package/tests/pages/object-no-additional-properties.html +65 -0
  247. package/tests/pages/object-no-duplicated-id.html +68 -0
  248. package/tests/pages/object-required-properties.html +236 -0
  249. package/tests/pages/object-with-dependencies-array.html +46 -0
  250. package/tests/pages/object-with-dependencies.html +60 -0
  251. package/tests/pages/object.html +79 -0
  252. package/tests/pages/oneof.html +103 -0
  253. package/tests/pages/option-no_default_values.html +58 -0
  254. package/tests/pages/programmatic-changes.html +120 -0
  255. package/tests/pages/read-only.html +105 -0
  256. package/tests/pages/select.html +41 -0
  257. package/tests/pages/stepper.html +59 -0
  258. package/tests/pages/string-ace-editor.html +52 -0
  259. package/tests/pages/string-cleave.html +46 -0
  260. package/tests/pages/string-custom-attributes.html +62 -0
  261. package/tests/pages/string-formats.html +52 -0
  262. package/tests/pages/string-formats2.html +57 -0
  263. package/tests/pages/string-jodit-editor.html +49 -0
  264. package/tests/pages/string-sceditor.html +62 -0
  265. package/tests/pages/table-move-events.html +56 -0
  266. package/tests/pages/table.html +46 -0
  267. package/tests/pages/tabs.html +131 -0
  268. package/tests/pages/themes.html +527 -0
  269. package/tests/pages/translate-property.html +247 -0
  270. package/tests/pages/urn.html +93 -0
  271. package/tests/pages/uuid.html +72 -0
  272. package/tests/pages/validation.html +99 -0
  273. package/tests/unit/.eslintrc +8 -0
  274. package/tests/unit/core.spec.js +309 -0
  275. package/tests/unit/defaults.spec.js +40 -0
  276. package/tests/unit/editor.spec.js +160 -0
  277. package/tests/unit/editors/array.spec.js +86 -0
  278. package/tests/unit/editors/object.spec.js +79 -0
  279. package/tests/unit/editors/table.spec.js +91 -0
  280. package/tests/unit/readme.md +35 -0
  281. package/tests/unit/schemaloader.spec.js +498 -0
  282. package/tests/unit/validator.spec.js +94 -0
  283. package/tests/unit/validators/ip-validator.spec.js +62 -0
@@ -0,0 +1,900 @@
1
+ /* global Feature Scenario */
2
+
3
+ var assert = require('assert');
4
+
5
+ Feature('array');
6
+
7
+ Scenario('should have correct initial value', async (I) => {
8
+ I.amOnPage('array.html');
9
+ I.click('.get-value');
10
+ assert.equal(await I.grabValueFrom('.debug'), '[]');
11
+ });
12
+
13
+ Scenario('should trigger array (table) editing triggers @retry', async (I) => {
14
+ I.amOnPage('table-move-events.html');
15
+ I.seeElement('[data-schemapath="root.0"]');
16
+ I.seeElement('[data-schemapath="root.1"]');
17
+ I.seeElement('[data-schemapath="root.2"]');
18
+ I.seeElement('[data-schemapath="root.3"]');
19
+ I.seeElement('[data-schemapath="root.4"]');
20
+ I.click('.get-value');
21
+ value = await I.grabValueFrom('.debug');
22
+ assert.equal(value, '["A","B","C","D","E"]');
23
+
24
+ I.amAcceptingPopups();
25
+ I.click('//button[contains(@class, "json-editor-btn-moveup") and @data-i="1"]');
26
+ I.retry({ retries: 5, minTimeout: 500 }).seeInPopup('moveRow');
27
+ I.acceptPopup();
28
+ I.click('.get-value');
29
+ value = await I.grabValueFrom('.debug');
30
+ assert.equal(value, '["B","A","C","D","E"]');
31
+
32
+ I.amAcceptingPopups();
33
+ I.click('//button[contains(@class, "json-editor-btn-movedown") and @data-i="1"]');
34
+ I.retry({ retries: 5, minTimeout: 500 }).seeInPopup('moveRow');
35
+ I.acceptPopup();
36
+ I.click('.get-value');
37
+ value = await I.grabValueFrom('.debug');
38
+ assert.equal(value, '["B","C","A","D","E"]');
39
+
40
+ I.amAcceptingPopups();
41
+ I.click('//button[contains(@class, "json-editor-btn-copy") and @data-i="2"]');
42
+ I.retry({ retries: 5, minTimeout: 500 }).seeInPopup('copyRow');
43
+ I.acceptPopup();
44
+ I.click('.get-value');
45
+ value = await I.grabValueFrom('.debug');
46
+ assert.equal(value, '["B","C","A","A","D","E"]');
47
+
48
+ I.amAcceptingPopups();
49
+ I.click('.json-editor-btntype-add');
50
+ I.retry({ retries: 5, minTimeout: 500 }).seeInPopup('addRow');
51
+ I.acceptPopup();
52
+ I.click('.get-value');
53
+ value = await I.grabValueFrom('.debug');
54
+ assert.equal(value, '["B","C","A","A","D","E",""]');
55
+
56
+ // This test will fail when using Puppeteer due to the way Puppeteer handles popups.
57
+ // Puppeteer apparently only sees the text in the last popup, so it doesn't see the
58
+ // 'Are you sure you want to remove this node?' popup text.
59
+ // ToDo: Change test so instead of using popup for test values like 'deleteRow', use a
60
+ // form field. Similar to the '.debug' field.
61
+ I.amAcceptingPopups();
62
+ I.click('.json-editor-btntype-deletelast');
63
+ I.retry({ retries: 5, minTimeout: 500 }).seeInPopup('Are you sure you want to remove this node?');
64
+ I.acceptPopup();
65
+ I.amAcceptingPopups();
66
+ I.retry({ retries: 5, minTimeout: 500 }).seeInPopup('deleteRow');
67
+ I.acceptPopup();
68
+ I.click('.get-value');
69
+ value = await I.grabValueFrom('.debug');
70
+ assert.equal(value, '["B","C","A","A","D","E"]');
71
+
72
+ // This test will fail when using Puppeteer due to the way Puppeteer handles popups.
73
+ I.amAcceptingPopups();
74
+ I.click('.json-editor-btntype-deleteall');
75
+ I.retry({ retries: 5, minTimeout: 500 }).seeInPopup('Are you sure you want to remove this node?');
76
+ I.acceptPopup();
77
+ I.amAcceptingPopups();
78
+ I.retry({ retries: 5, minTimeout: 500 }).seeInPopup('deleteAllRows');
79
+ I.acceptPopup();
80
+ I.click('.get-value');
81
+ value = await I.grabValueFrom('.debug');
82
+ assert.equal(value, '[]');
83
+ });
84
+
85
+ Scenario('should array editing triggers', async (I) => {
86
+ I.amOnPage('array-move-events.html');
87
+ I.seeElement('[data-schemapath="root.0"]');
88
+ I.seeElement('[data-schemapath="root.1"]');
89
+ I.click('.get-value');
90
+ assert.equal(await I.grabValueFrom('.debug'), '["A","B"]');
91
+
92
+ I.click('.json-editor-btn-moveup');
93
+ assert.equal(await I.grabValueFrom('.action'), 'moveRow');
94
+ I.click('.get-value');
95
+ assert.equal(await I.grabValueFrom('.debug'), '["B","A"]');
96
+
97
+ I.click('.json-editor-btn-movedown');
98
+ assert.equal(await I.grabValueFrom('.action'), 'moveRow');
99
+ I.click('.get-value');
100
+ assert.equal(await I.grabValueFrom('.debug'), '["A","B"]');
101
+
102
+ I.click('.json-editor-btntype-add');
103
+ assert.equal(await I.grabValueFrom('.action'), 'addRow');
104
+ I.click('.get-value');
105
+ assert.equal(await I.grabValueFrom('.debug'), '["A","B",""]');
106
+
107
+ I.amAcceptingPopups();
108
+ I.click('.json-editor-btntype-deletelast');
109
+ I.seeInPopup('Are you sure you want to remove this node?');
110
+ I.acceptPopup();
111
+ assert.equal(await I.grabValueFrom('.action'), 'deleteRow');
112
+ I.click('.get-value');
113
+ assert.equal(await I.grabValueFrom('.debug'), '["A","B"]');
114
+
115
+ I.amAcceptingPopups();
116
+ I.click('.json-editor-btntype-deleteall');
117
+ I.seeInPopup('Are you sure you want to remove this node?');
118
+ I.acceptPopup();
119
+ assert.equal(await I.grabValueFrom('.action'), 'deleteAllRows');
120
+ I.click('.get-value');
121
+ assert.equal(await I.grabValueFrom('.debug'), '[]');
122
+ });
123
+
124
+ Scenario('should work well with string editors', async (I) => {
125
+ I.amOnPage('array-strings.html');
126
+ I.click('Add String');
127
+ I.click('Add String');
128
+ I.click('Add String');
129
+ I.click('Add String');
130
+ I.click('Add String');
131
+ I.seeElement('[name="root[0]"]');
132
+ I.seeElement('[name="root[1]"]');
133
+ I.seeElement('[name="root[2]"]');
134
+ I.seeElement('[name="root[3]"]');
135
+ I.seeElement('[name="root[4]"]');
136
+ I.fillField('[name="root[0]"]', "1");
137
+ I.fillField('[name="root[1]"]', "2");
138
+ I.fillField('[name="root[2]"]', "3");
139
+ I.fillField('[name="root[3]"]', "4");
140
+ I.fillField('[name="root[4]"]', "5");
141
+ I.click('.get-value');
142
+ assert.equal(await I.grabValueFrom('.debug'), '["1","2","3","4","5"]');
143
+
144
+ // shuffle
145
+ I.click('.moveup[data-i="4"]');
146
+ I.click('.moveup[data-i="2"]');
147
+ I.click('.moveup[data-i="1"]');
148
+ I.click('.get-value');
149
+ assert.equal(await I.grabValueFrom('.debug'), '["3","1","2","5","4"]');
150
+
151
+ // delete single
152
+ I.see('String 5');
153
+ I.amCancellingPopups();
154
+ I.click('[data-schemapath="root.4"] .delete');
155
+ I.seeInPopup('Are you sure you want to remove this node?');
156
+ I.cancelPopup();
157
+ I.see('String 5');
158
+ I.amAcceptingPopups();
159
+ I.click('[data-schemapath="root.4"] .delete');
160
+ I.seeInPopup('Are you sure you want to remove this node?');
161
+ I.acceptPopup();
162
+ I.dontSee('String 5');
163
+
164
+ // delete last
165
+ I.see('String 4');
166
+ I.amCancellingPopups();
167
+ I.click('Delete Last String');
168
+ I.seeInPopup('Are you sure you want to remove this node?');
169
+ I.cancelPopup();
170
+ I.see('String 4');
171
+ I.amAcceptingPopups();
172
+ I.click('Delete Last String');
173
+ I.seeInPopup('Are you sure you want to remove this node?');
174
+ I.acceptPopup();
175
+ I.dontSee('String 4');
176
+
177
+ // delete all
178
+ I.see('String 1');
179
+ I.see('String 2');
180
+ I.see('String 3');
181
+ I.amCancellingPopups();
182
+ I.click('Delete All');
183
+ I.seeInPopup('Are you sure you want to remove this node?');
184
+ I.cancelPopup();
185
+ I.see('String 1');
186
+ I.see('String 2');
187
+ I.see('String 3');
188
+ I.amAcceptingPopups();
189
+ I.click('Delete All');
190
+ I.seeInPopup('Are you sure you want to remove this node?');
191
+ I.acceptPopup();
192
+ I.dontSee('String 1');
193
+ I.dontSee('String 2');
194
+ I.dontSee('String 3');
195
+ });
196
+
197
+ Scenario('should work well with number editors', async (I) => {
198
+ I.amOnPage('array-numbers.html');
199
+ I.click('Add Number');
200
+ I.click('Add Number');
201
+ I.click('Add Number');
202
+ I.click('Add Number');
203
+ I.click('Add Number');
204
+ I.seeElement('[name="root[0]"]');
205
+ I.seeElement('[name="root[1]"]');
206
+ I.seeElement('[name="root[2]"]');
207
+ I.seeElement('[name="root[3]"]');
208
+ I.seeElement('[name="root[4]"]');
209
+ I.fillField('[name="root[0]"]', "1");
210
+ I.fillField('[name="root[1]"]', "2");
211
+ I.fillField('[name="root[2]"]', "3");
212
+ I.fillField('[name="root[3]"]', "4");
213
+ I.fillField('[name="root[4]"]', "5");
214
+ I.click('.get-value');
215
+ assert.equal(await I.grabValueFrom('.debug'), '[1,2,3,4,5]');
216
+
217
+ // shuffle
218
+ I.click('.moveup[data-i="4"]');
219
+ I.click('.moveup[data-i="2"]');
220
+ I.click('.moveup[data-i="1"]');
221
+ I.click('.get-value');
222
+ assert.equal(await I.grabValueFrom('.debug'), '[3,1,2,5,4]');
223
+
224
+ // delete single
225
+ I.see('Number 5');
226
+ I.amCancellingPopups();
227
+ I.click('[data-schemapath="root.4"] .delete');
228
+ I.seeInPopup('Are you sure you want to remove this node?');
229
+ I.cancelPopup();
230
+ I.see('Number 5');
231
+ I.amAcceptingPopups();
232
+ I.click('[data-schemapath="root.4"] .delete');
233
+ I.seeInPopup('Are you sure you want to remove this node?');
234
+ I.acceptPopup();
235
+ I.dontSee('Number 5');
236
+
237
+ // delete last
238
+ I.see('Number 4');
239
+ I.amCancellingPopups();
240
+ I.click('Delete Last Number');
241
+ I.seeInPopup('Are you sure you want to remove this node?');
242
+ I.cancelPopup();
243
+ I.see('Number 4');
244
+ I.amAcceptingPopups();
245
+ I.click('Delete Last Number');
246
+ I.seeInPopup('Are you sure you want to remove this node?');
247
+ I.acceptPopup();
248
+ I.dontSee('Number 4');
249
+
250
+ // delete all
251
+ I.see('Number 1');
252
+ I.see('Number 2');
253
+ I.see('Number 3');
254
+ I.amCancellingPopups();
255
+ I.click('Delete All');
256
+ I.seeInPopup('Are you sure you want to remove this node?');
257
+ I.cancelPopup();
258
+ I.see('Number 1');
259
+ I.see('Number 2');
260
+ I.see('Number 3');
261
+ I.amAcceptingPopups();
262
+ I.click('Delete All');
263
+ I.seeInPopup('Are you sure you want to remove this node?');
264
+ I.acceptPopup();
265
+ I.dontSee('Number 1');
266
+ I.dontSee('Number 2');
267
+ I.dontSee('Number 3');
268
+ });
269
+
270
+ Scenario('should work well with integer editors', async (I) => {
271
+ I.amOnPage('array-integers.html');
272
+ I.click('Add Integer');
273
+ I.click('Add Integer');
274
+ I.click('Add Integer');
275
+ I.click('Add Integer');
276
+ I.click('Add Integer');
277
+ I.seeElement('[name="root[0]"]');
278
+ I.seeElement('[name="root[1]"]');
279
+ I.seeElement('[name="root[2]"]');
280
+ I.seeElement('[name="root[3]"]');
281
+ I.seeElement('[name="root[4]"]');
282
+ I.fillField('[name="root[0]"]', "1");
283
+ I.fillField('[name="root[1]"]', "2");
284
+ I.fillField('[name="root[2]"]', "3");
285
+ I.fillField('[name="root[3]"]', "4");
286
+ I.fillField('[name="root[4]"]', "5");
287
+ I.click('.get-value');
288
+ assert.equal(await I.grabValueFrom('.debug'), '[1,2,3,4,5]');
289
+
290
+ // shuffle
291
+ I.click('.moveup[data-i="4"]');
292
+ I.click('.moveup[data-i="2"]');
293
+ I.click('.moveup[data-i="1"]');
294
+ I.click('.get-value');
295
+ assert.equal(await I.grabValueFrom('.debug'), '[3,1,2,5,4]');
296
+
297
+ // delete single
298
+ I.see('Integer 5');
299
+ I.amCancellingPopups();
300
+ I.click('[data-schemapath="root.4"] .delete');
301
+ I.seeInPopup('Are you sure you want to remove this node?');
302
+ I.cancelPopup();
303
+ I.see('Integer 5');
304
+ I.amAcceptingPopups();
305
+ I.click('[data-schemapath="root.4"] .delete');
306
+ I.seeInPopup('Are you sure you want to remove this node?');
307
+ I.acceptPopup();
308
+ I.dontSee('Integer 5');
309
+
310
+ // delete last
311
+ I.see('Integer 4');
312
+ I.amCancellingPopups();
313
+ I.click('Delete Last Integer');
314
+ I.seeInPopup('Are you sure you want to remove this node?');
315
+ I.cancelPopup();
316
+ I.see('Integer 4');
317
+ I.amAcceptingPopups();
318
+ I.click('Delete Last Integer');
319
+ I.seeInPopup('Are you sure you want to remove this node?');
320
+ I.acceptPopup();
321
+ I.dontSee('Integer 4');
322
+
323
+ // delete all
324
+ I.see('Integer 1');
325
+ I.see('Integer 2');
326
+ I.see('Integer 3');
327
+ I.amCancellingPopups();
328
+ I.click('Delete All');
329
+ I.seeInPopup('Are you sure you want to remove this node?');
330
+ I.cancelPopup();
331
+ I.see('Integer 1');
332
+ I.see('Integer 2');
333
+ I.see('Integer 3');
334
+ I.amAcceptingPopups();
335
+ I.click('Delete All');
336
+ I.seeInPopup('Are you sure you want to remove this node?');
337
+ I.acceptPopup();
338
+ I.dontSee('Integer 1');
339
+ I.dontSee('Integer 2');
340
+ I.dontSee('Integer 3');
341
+ });
342
+
343
+ Scenario('should work well with select editors', async (I) => {
344
+ I.amOnPage('array-selects.html');
345
+ I.click('Add Select');
346
+ I.click('Add Select');
347
+ I.seeElement('[name="root[0]"]');
348
+ I.seeElement('[name="root[1]"]');
349
+ I.selectOption('[name="root[0]"]', "true");
350
+ I.selectOption('[name="root[1]"]', "false");
351
+ I.click('.get-value');
352
+ assert.equal(await I.grabValueFrom('.debug'), '[true,false]');
353
+
354
+ // shuffle
355
+ I.click('.moveup[data-i="1"]');
356
+ I.click('.get-value');
357
+ assert.equal(await I.grabValueFrom('.debug'), '[false,true]');
358
+
359
+ // delete single
360
+ I.click('Add Select');
361
+ I.click('Add Select');
362
+ I.click('Add Select');
363
+ I.see('Select 5');
364
+ I.amCancellingPopups();
365
+ I.click('[data-schemapath="root.4"] .delete');
366
+ I.seeInPopup('Are you sure you want to remove this node?');
367
+ I.cancelPopup();
368
+ I.see('Select 5');
369
+ I.amAcceptingPopups();
370
+ I.click('[data-schemapath="root.4"] .delete');
371
+ I.seeInPopup('Are you sure you want to remove this node?');
372
+ I.acceptPopup();
373
+ I.dontSee('Select 5');
374
+
375
+ // delete last
376
+ I.see('Select 4');
377
+ I.amCancellingPopups();
378
+ I.click('Delete Last Select');
379
+ I.seeInPopup('Are you sure you want to remove this node?');
380
+ I.cancelPopup();
381
+ I.see('Select 4');
382
+ I.amAcceptingPopups();
383
+ I.click('Delete Last Select');
384
+ I.seeInPopup('Are you sure you want to remove this node?');
385
+ I.acceptPopup();
386
+ I.dontSee('Select 4');
387
+
388
+ // delete all
389
+ I.see('Select 1');
390
+ I.see('Select 2');
391
+ I.see('Select 3');
392
+ I.amCancellingPopups();
393
+ I.click('Delete All');
394
+ I.seeInPopup('Are you sure you want to remove this node?');
395
+ I.cancelPopup();
396
+ I.see('Select 1');
397
+ I.see('Select 2');
398
+ I.see('Select 3');
399
+ I.amAcceptingPopups();
400
+ I.click('Delete All');
401
+ I.seeInPopup('Are you sure you want to remove this node?');
402
+ I.acceptPopup();
403
+ I.dontSee('Select 1');
404
+ I.dontSee('Select 2');
405
+ I.dontSee('Select 3');
406
+ });
407
+
408
+ Scenario('should work well with checkbox editors', async (I) => {
409
+ I.amOnPage('array-checkboxes.html');
410
+ I.click('Add Checkbox');
411
+ I.click('Add Checkbox');
412
+ I.click('Add Checkbox');
413
+ I.click('Add Checkbox');
414
+ I.click('Add Checkbox');
415
+ I.seeElement('[data-schemapath="root.0"]');
416
+ I.seeElement('[data-schemapath="root.1"]');
417
+ I.seeElement('[data-schemapath="root.2"]');
418
+ I.seeElement('[data-schemapath="root.3"]');
419
+ I.seeElement('[data-schemapath="root.4"]');
420
+ I.checkOption('1', '[data-schemapath="root.0"]');
421
+ I.checkOption('2', '[data-schemapath="root.1"]');
422
+ I.checkOption('3', '[data-schemapath="root.2"]');
423
+ I.checkOption('4', '[data-schemapath="root.3"]');
424
+ I.checkOption('5', '[data-schemapath="root.4"]');
425
+ I.click('.get-value');
426
+ assert.equal(await I.grabValueFrom('.debug'), '[["1"],["2"],["3"],["4"],["5"]]');
427
+
428
+ // shuffle
429
+ I.click('.moveup[data-i="4"]');
430
+ I.click('.moveup[data-i="2"]');
431
+ I.click('.moveup[data-i="1"]');
432
+ I.click('.get-value');
433
+ assert.equal(await I.grabValueFrom('.debug'), '[["3"],["1"],["2"],["5"],["4"]]');
434
+
435
+ // delete single
436
+ I.see('Checkbox 5');
437
+ I.amCancellingPopups();
438
+ I.click('[data-schemapath="root.4"] .delete');
439
+ I.seeInPopup('Are you sure you want to remove this node?');
440
+ I.cancelPopup();
441
+ I.see('Checkbox 5');
442
+ I.amAcceptingPopups();
443
+ I.click('[data-schemapath="root.4"] .delete');
444
+ I.seeInPopup('Are you sure you want to remove this node?');
445
+ I.acceptPopup();
446
+ I.dontSee('Checkbox 5');
447
+
448
+ // delete last
449
+ I.see('Checkbox 4');
450
+ I.amCancellingPopups();
451
+ I.click('Delete Last Checkbox');
452
+ I.seeInPopup('Are you sure you want to remove this node?');
453
+ I.cancelPopup();
454
+ I.see('Checkbox 4');
455
+ I.amAcceptingPopups();
456
+ I.click('Delete Last Checkbox');
457
+ I.seeInPopup('Are you sure you want to remove this node?');
458
+ I.acceptPopup();
459
+ I.dontSee('Checkbox 4');
460
+
461
+ // delete all
462
+ I.see('Checkbox 1');
463
+ I.see('Checkbox 2');
464
+ I.see('Checkbox 3');
465
+ I.amCancellingPopups();
466
+ I.click('Delete All');
467
+ I.seeInPopup('Are you sure you want to remove this node?');
468
+ I.cancelPopup();
469
+ I.see('Checkbox 1');
470
+ I.see('Checkbox 2');
471
+ I.see('Checkbox 3');
472
+ I.amAcceptingPopups();
473
+ I.click('Delete All');
474
+ I.seeInPopup('Are you sure you want to remove this node?');
475
+ I.acceptPopup();
476
+ I.dontSee('Checkbox 1');
477
+ I.dontSee('Checkbox 2');
478
+ I.dontSee('Checkbox 3');
479
+ });
480
+
481
+ Scenario('should work well with rating editors', async (I) => {
482
+ I.amOnPage('array-ratings.html');
483
+ I.seeElement('[data-schemapath="root.0"]');
484
+ I.seeElement('[data-schemapath="root.1"]');
485
+ I.seeElement('[data-schemapath="root.2"]');
486
+ I.seeElement('[data-schemapath="root.3"]');
487
+ I.seeElement('[data-schemapath="root.4"]');
488
+ I.click('.get-value');
489
+ assert.equal(await I.grabValueFrom('.debug'), '[1,2,3,4,5]');
490
+
491
+ // shuffle
492
+ I.click('.moveup[data-i="4"]');
493
+ I.click('.moveup[data-i="2"]');
494
+ I.click('.moveup[data-i="1"]');
495
+ I.click('.get-value');
496
+ assert.equal(await I.grabValueFrom('.debug'), '[3,1,2,5,4]');
497
+
498
+ // delete single
499
+ I.see('Rating 5');
500
+ I.amCancellingPopups();
501
+ I.click('[data-schemapath="root.4"] .delete');
502
+ I.seeInPopup('Are you sure you want to remove this node?');
503
+ I.cancelPopup();
504
+ I.see('Rating 5');
505
+ I.amAcceptingPopups();
506
+ I.click('[data-schemapath="root.4"] .delete');
507
+ I.seeInPopup('Are you sure you want to remove this node?');
508
+ I.acceptPopup();
509
+ I.dontSee('Rating 5');
510
+
511
+ // delete last
512
+ I.see('Rating 4');
513
+ I.amCancellingPopups();
514
+ I.click('Delete Last Rating');
515
+ I.seeInPopup('Are you sure you want to remove this node?');
516
+ I.cancelPopup();
517
+ I.see('Rating 4');
518
+ I.amAcceptingPopups();
519
+ I.click('Delete Last Rating');
520
+ I.seeInPopup('Are you sure you want to remove this node?');
521
+ I.acceptPopup();
522
+ I.dontSee('Rating 4');
523
+
524
+ // delete all
525
+ I.see('Rating 1');
526
+ I.see('Rating 2');
527
+ I.see('Rating 3');
528
+ I.amCancellingPopups();
529
+ I.click('Delete All');
530
+ I.seeInPopup('Are you sure you want to remove this node?');
531
+ I.cancelPopup();
532
+ I.see('Rating 1');
533
+ I.see('Rating 2');
534
+ I.see('Rating 3');
535
+ I.amAcceptingPopups();
536
+ I.click('Delete All');
537
+ I.seeInPopup('Are you sure you want to remove this node?');
538
+ I.acceptPopup();
539
+ I.dontSee('Rating 1');
540
+ I.dontSee('Rating 2');
541
+ I.dontSee('Rating 3');
542
+ });
543
+
544
+ Scenario('should work well with multiselect editors', async (I) => {
545
+ I.amOnPage('array-multiselects.html');
546
+ I.click('Add Multiselect');
547
+ I.click('Add Multiselect');
548
+ I.click('Add Multiselect');
549
+ I.click('Add Multiselect');
550
+ I.click('Add Multiselect');
551
+ I.seeElement('[data-schemapath="root.0"]');
552
+ I.seeElement('[data-schemapath="root.1"]');
553
+ I.seeElement('[data-schemapath="root.2"]');
554
+ I.seeElement('[data-schemapath="root.3"]');
555
+ I.seeElement('[data-schemapath="root.4"]');
556
+ I.selectOption('[name="root[0]"]', "1");
557
+ I.selectOption('[name="root[1]"]', "2");
558
+ I.selectOption('[name="root[2]"]', "3");
559
+ I.selectOption('[name="root[3]"]', "4");
560
+ I.selectOption('[name="root[4]"]', "5");
561
+ I.click('.get-value');
562
+ assert.equal(await I.grabValueFrom('.debug'), '[["1"],["2"],["3"],["4"],["5"]]');
563
+
564
+ // shuffle
565
+ I.click('.moveup[data-i="4"]');
566
+ I.click('.moveup[data-i="2"]');
567
+ I.click('.moveup[data-i="1"]');
568
+ I.click('.get-value');
569
+ assert.equal(await I.grabValueFrom('.debug'), '[["3"],["1"],["2"],["5"],["4"]]');
570
+
571
+ // delete single
572
+ I.see('Multiselect 5');
573
+ I.amCancellingPopups();
574
+ I.click('[data-schemapath="root.4"] .delete');
575
+ I.seeInPopup('Are you sure you want to remove this node?');
576
+ I.cancelPopup();
577
+ I.see('Multiselect 5');
578
+ I.amAcceptingPopups();
579
+ I.click('[data-schemapath="root.4"] .delete');
580
+ I.seeInPopup('Are you sure you want to remove this node?');
581
+ I.acceptPopup();
582
+ I.dontSee('Multiselect 5');
583
+
584
+ // delete last
585
+ I.see('Multiselect 4');
586
+ I.amCancellingPopups();
587
+ I.click('Delete Last Multiselect');
588
+ I.seeInPopup('Are you sure you want to remove this node?');
589
+ I.cancelPopup();
590
+ I.see('Multiselect 4');
591
+ I.click('Delete Last Multiselect');
592
+ I.seeInPopup('Are you sure you want to remove this node?');
593
+ I.acceptPopup();
594
+ I.dontSee('Multiselect 4');
595
+
596
+ // delete all
597
+ I.see('Multiselect 1');
598
+ I.see('Multiselect 2');
599
+ I.see('Multiselect 3');
600
+ I.amCancellingPopups();
601
+ I.click('Delete All');
602
+ I.seeInPopup('Are you sure you want to remove this node?');
603
+ I.cancelPopup();
604
+ I.see('Multiselect 1');
605
+ I.see('Multiselect 2');
606
+ I.see('Multiselect 3');
607
+ I.amAcceptingPopups();
608
+ I.click('Delete All');
609
+ I.seeInPopup('Are you sure you want to remove this node?');
610
+ I.acceptPopup();
611
+ I.dontSee('Multiselect 1');
612
+ I.dontSee('Multiselect 2');
613
+ I.dontSee('Multiselect 3');
614
+ });
615
+
616
+ Scenario('should work well with object editors', async (I) => {
617
+ I.amOnPage('array-objects.html');
618
+ I.click('Add Object');
619
+ I.click('Add Object');
620
+ I.click('Add Object');
621
+ I.click('Add Object');
622
+ I.click('Add Object');
623
+ I.seeElement('[name="root[0][property]"]');
624
+ I.seeElement('[name="root[1][property]"]');
625
+ I.seeElement('[name="root[2][property]"]');
626
+ I.seeElement('[name="root[3][property]"]');
627
+ I.seeElement('[name="root[4][property]"]');
628
+ I.fillField('[name="root[0][property]"]', "1");
629
+ I.fillField('[name="root[1][property]"]', "2");
630
+ I.fillField('[name="root[2][property]"]', "3");
631
+ I.fillField('[name="root[3][property]"]', "4");
632
+ I.fillField('[name="root[4][property]"]', "5");
633
+ I.click('.get-value');
634
+ assert.equal(await I.grabValueFrom('.debug'), '[{"property":"1"},{"property":"2"},{"property":"3"},{"property":"4"},{"property":"5"}]');
635
+
636
+ // shuffle
637
+ I.click('.moveup[data-i="4"]');
638
+ I.click('.moveup[data-i="2"]');
639
+ I.click('.moveup[data-i="1"]');
640
+ I.click('.get-value');
641
+ assert.equal(await I.grabValueFrom('.debug'), '[{"property":"3"},{"property":"1"},{"property":"2"},{"property":"5"},{"property":"4"}]');
642
+
643
+ // delete single
644
+ I.see('Object 5');
645
+ I.amCancellingPopups();
646
+ I.click('[data-schemapath="root.4"] .delete');
647
+ I.seeInPopup('Are you sure you want to remove this node?');
648
+ I.cancelPopup();
649
+ I.see('Object 5');
650
+ I.amAcceptingPopups();
651
+ I.click('[data-schemapath="root.4"] .delete');
652
+ I.seeInPopup('Are you sure you want to remove this node?');
653
+ I.acceptPopup();
654
+ I.dontSee('Object 5');
655
+
656
+ // delete last
657
+ I.see('Object 4');
658
+ I.amCancellingPopups();
659
+ I.click('Delete Last Object');
660
+ I.seeInPopup('Are you sure you want to remove this node?');
661
+ I.cancelPopup();
662
+ I.see('Object 4');
663
+ I.amAcceptingPopups();
664
+ I.click('Delete Last Object');
665
+ I.seeInPopup('Are you sure you want to remove this node?');
666
+ I.acceptPopup();
667
+ I.dontSee('Object 4');
668
+
669
+ // delete all
670
+ I.see('Object 1');
671
+ I.see('Object 2');
672
+ I.see('Object 3');
673
+ I.amCancellingPopups();
674
+ I.click('Delete All');
675
+ I.seeInPopup('Are you sure you want to remove this node?');
676
+ I.cancelPopup();
677
+ I.see('Object 1');
678
+ I.see('Object 2');
679
+ I.see('Object 3');
680
+ I.amAcceptingPopups();
681
+ I.click('Delete All');
682
+ I.seeInPopup('Are you sure you want to remove this node?');
683
+ I.acceptPopup();
684
+ I.dontSee('Object 1');
685
+ I.dontSee('Object 2');
686
+ I.dontSee('Object 3');
687
+ });
688
+
689
+ Scenario('should work well with nested array editors', async (I) => {
690
+ I.amOnPage('array-nested-arrays.html');
691
+ I.click('Add Array');
692
+ I.click('Add Array');
693
+ I.click('Add Array');
694
+ I.click('Add Array');
695
+ I.click('Add Array');
696
+ I.seeElement('[data-schemapath="root.0"]');
697
+ I.seeElement('[data-schemapath="root.1"]');
698
+ I.seeElement('[data-schemapath="root.2"]');
699
+ I.seeElement('[data-schemapath="root.3"]');
700
+ I.seeElement('[data-schemapath="root.4"]');
701
+ I.click('.get-value');
702
+ assert.equal(await I.grabValueFrom('.debug'), '[[],[],[],[],[]]');
703
+
704
+ // adds one string editor in each first level array
705
+ for (let i = 0; i < 5; i++) {
706
+ I.click('Add String', '[data-schemapath="root.' + i + '"]');
707
+ I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][0]"]', String(i + 1));
708
+ }
709
+
710
+ I.click('.get-value');
711
+ assert.equal(await I.grabValueFrom('.debug'), '[["1"],["2"],["3"],["4"],["5"]]');
712
+
713
+ // shuffle
714
+ I.click('.moveup[data-i="4"]');
715
+ I.click('.moveup[data-i="2"]');
716
+ I.click('.moveup[data-i="1"]');
717
+ I.click('.get-value');
718
+ assert.equal(await I.grabValueFrom('.debug'), '[["3"],["1"],["2"],["5"],["4"]]');
719
+
720
+ // delete single
721
+ I.see('Array 5');
722
+ I.amCancellingPopups();
723
+ I.click('[data-schemapath="root.4"] .delete');
724
+ I.seeInPopup('Are you sure you want to remove this node?');
725
+ I.cancelPopup();
726
+ I.see('Array 5');
727
+ I.amAcceptingPopups();
728
+ I.click('[data-schemapath="root.4"] .delete');
729
+ I.seeInPopup('Are you sure you want to remove this node?');
730
+ I.acceptPopup();
731
+ I.dontSee('Array 5');
732
+
733
+ // delete last
734
+ I.see('Array 4');
735
+ I.amCancellingPopups();
736
+ I.click('Delete Last Array');
737
+ I.seeInPopup('Are you sure you want to remove this node?');
738
+ I.cancelPopup();
739
+ I.see('Array 4');
740
+ I.amAcceptingPopups();
741
+ I.click('Delete Last Array');
742
+ I.seeInPopup('Are you sure you want to remove this node?');
743
+ I.acceptPopup();
744
+ I.dontSee('Array 4');
745
+
746
+ // delete all
747
+ I.see('Array 1');
748
+ I.see('Array 2');
749
+ I.see('Array 3');
750
+ // there are hidden "Delete All" buttons right now and "I.click(Delete All)"
751
+ // will attempt to click the first match. It fails because is hidden.
752
+ // this is why i use this script. is more flexible.
753
+ I.amCancellingPopups();
754
+ I.executeScript(function() {
755
+ var e = document.querySelectorAll('.json-editor-btn-delete');
756
+ e[e.length - 1].click();
757
+ });
758
+ I.seeInPopup('Are you sure you want to remove this node?');
759
+ I.cancelPopup();
760
+ I.see('Array 1');
761
+ I.see('Array 2');
762
+ I.see('Array 3');
763
+ I.amAcceptingPopups();
764
+ I.executeScript(function() {
765
+ var e = document.querySelectorAll('.json-editor-btn-delete');
766
+ e[e.length - 1].click();
767
+ });
768
+ I.seeInPopup('Are you sure you want to remove this node?');
769
+ I.acceptPopup();
770
+ I.dontSee('Array 1');
771
+ I.dontSee('Array 2');
772
+ I.dontSee('Array 3');
773
+
774
+ // manipulate nested items
775
+ I.amOnPage('array-nested-arrays.html');
776
+ I.click('Add Array');
777
+ I.click('Add Array');
778
+ I.click('Add Array');
779
+ I.click('Add Array');
780
+ I.click('Add Array');
781
+ I.seeElement('[data-schemapath="root.0"]');
782
+ I.seeElement('[data-schemapath="root.1"]');
783
+ I.seeElement('[data-schemapath="root.2"]');
784
+ I.click('.get-value');
785
+ assert.equal(await I.grabValueFrom('.debug'), '[[],[],[],[],[]]');
786
+
787
+ // adds one string editor in each first level array
788
+ for (let i = 0; i < 5; i++) {
789
+ I.click('Add String', '[data-schemapath="root.' + i + '"]');
790
+ I.click('Add String', '[data-schemapath="root.' + i + '"]');
791
+ I.click('Add String', '[data-schemapath="root.' + i + '"]');
792
+ I.click('Add String', '[data-schemapath="root.' + i + '"]');
793
+ I.click('Add String', '[data-schemapath="root.' + i + '"]');
794
+ I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][0]"]', "1");
795
+ I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][1]"]', "2");
796
+ I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][2]"]', "3");
797
+ I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][3]"]', "4");
798
+ I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][4]"]', "5");
799
+ }
800
+
801
+ I.click('.get-value');
802
+ assert.equal(await I.grabValueFrom('.debug'), '[["1","2","3","4","5"],["1","2","3","4","5"],["1","2","3","4","5"],["1","2","3","4","5"],["1","2","3","4","5"]]');
803
+
804
+ // shuffle every strings array
805
+ for (let i = 0; i < 5; i++) {
806
+ I.click('[data-schemapath="root.' + i + '.4"] .moveup');
807
+ I.click('[data-schemapath="root.' + i + '.2"] .moveup');
808
+ I.click('[data-schemapath="root.' + i + '.1"] .moveup');
809
+ }
810
+
811
+ I.click('.get-value');
812
+ assert.equal(await I.grabValueFrom('.debug'), '[["3","1","2","5","4"],["3","1","2","5","4"],["3","1","2","5","4"],["3","1","2","5","4"],["3","1","2","5","4"]]');
813
+
814
+ // delete single (fifth) element from every string array
815
+ for (let i = 0; i < 5; i++) {
816
+ I.see('String 5', '[data-schemapath="root.' + i + '"]');
817
+ I.amCancellingPopups();
818
+ I.click('[data-schemapath="root.' + i + '.4"] .delete');
819
+ I.seeInPopup('Are you sure you want to remove this node?');
820
+ I.cancelPopup();
821
+ I.see('String 5', '[data-schemapath="root.' + i + '"]');
822
+ I.amAcceptingPopups();
823
+ I.click('[data-schemapath="root.' + i + '.4"] .delete');
824
+ I.seeInPopup('Are you sure you want to remove this node?');
825
+ I.acceptPopup();
826
+ I.dontSee('String 5', '[data-schemapath="root.' + i + '"]');
827
+ }
828
+
829
+ I.click('.get-value');
830
+ assert.equal(await I.grabValueFrom('.debug'), '[["3","1","2","5"],["3","1","2","5"],["3","1","2","5"],["3","1","2","5"],["3","1","2","5"]]');
831
+
832
+ // delete last (fourth) element from every string array
833
+ for (let i = 0; i < 5; i++) {
834
+ I.see('String 4', '[data-schemapath="root.' + i + '"]');
835
+ I.amCancellingPopups();
836
+ I.click('Delete Last String', '[data-schemapath="root.' + i + '"]');
837
+ I.seeInPopup('Are you sure you want to remove this node?');
838
+ I.cancelPopup();
839
+ I.see('String 4', '[data-schemapath="root.' + i + '"]');
840
+ I.amAcceptingPopups();
841
+ I.click('Delete Last String', '[data-schemapath="root.' + i + '"]');
842
+ I.seeInPopup('Are you sure you want to remove this node?');
843
+ I.acceptPopup();
844
+ I.dontSee('String 4', '[data-schemapath="root.' + i + '"]');
845
+ }
846
+
847
+ I.click('.get-value');
848
+ assert.equal(await I.grabValueFrom('.debug'), '[["3","1","2"],["3","1","2"],["3","1","2"],["3","1","2"],["3","1","2"]]');
849
+
850
+ // delete last (fourth) element from every string array
851
+ for (let i = 0; i < 5; i++) {
852
+ I.see('String 1', '[data-schemapath="root.' + i + '"]');
853
+ I.see('String 2', '[data-schemapath="root.' + i + '"]');
854
+ I.see('String 3', '[data-schemapath="root.' + i + '"]');
855
+ I.amCancellingPopups();
856
+ I.click('Delete All', '[data-schemapath="root.' + i + '"]');
857
+ I.seeInPopup('Are you sure you want to remove this node?');
858
+ I.cancelPopup();
859
+ I.see('String 1', '[data-schemapath="root.' + i + '"]');
860
+ I.see('String 2', '[data-schemapath="root.' + i + '"]');
861
+ I.see('String 3', '[data-schemapath="root.' + i + '"]');
862
+ I.amAcceptingPopups();
863
+ I.click('Delete All', '[data-schemapath="root.' + i + '"]');
864
+ I.seeInPopup('Are you sure you want to remove this node?');
865
+ I.acceptPopup();
866
+ I.dontSee('String 1', '[data-schemapath="root.' + i + '"]');
867
+ I.dontSee('String 2', '[data-schemapath="root.' + i + '"]');
868
+ I.dontSee('String 3', '[data-schemapath="root.' + i + '"]');
869
+ }
870
+
871
+ I.click('.get-value');
872
+ assert.equal(await I.grabValueFrom('.debug'), '[[],[],[],[],[]]');
873
+ });
874
+
875
+ Scenario('should work well with selectize multiselect editors', async (I) => {
876
+ I.amOnPage('array-selectize.html');
877
+ I.click('Add item');
878
+ await I.seeElement('[data-schemapath="root.0"]');
879
+ I.click('Add item');
880
+ await I.seeElement('[data-schemapath="root.1"]');
881
+ I.click('.get-value');
882
+ value = await I.grabValueFrom('.debug');
883
+ // ensure defaults
884
+ assert.equal(value, '[["1","2"],["1","2"]]');
885
+
886
+ // every selected item has remove button
887
+ I.seeElement('[data-schemapath="root.0"] .selectize-input [data-value="1"] a.remove');
888
+ I.seeElement('[data-schemapath="root.0"] .selectize-input [data-value="2"] a.remove');
889
+ I.seeElement('[data-schemapath="root.1"] .selectize-input [data-value="1"] a.remove');
890
+ I.seeElement('[data-schemapath="root.1"] .selectize-input [data-value="2"] a.remove');
891
+
892
+ // could not add values
893
+ I.fillField('[data-schemapath="root.1"] input[type="text"]', "123");
894
+ I.dontSeeElement('.create.active');
895
+
896
+ // selectize dropdown is filled with enum values
897
+ I.click('[data-schemapath="root.0"] .selectize-input');
898
+ I.seeElement('[data-schemapath="root.0"] .selectize-dropdown-content [data-value="3"]');
899
+ I.seeElement('[data-schemapath="root.0"] .selectize-dropdown-content [data-value="4"]');
900
+ });