@json-editor/json-editor 2.9.1 → 2.10.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +52 -1
  3. package/dist/jsoneditor.js +1 -1
  4. package/dist/jsoneditor.js.LICENSE.txt +1 -1
  5. package/dist/nonmin/jsoneditor.js +462 -124
  6. package/dist/nonmin/jsoneditor.js.map +1 -1
  7. package/docs/css_integration.html +17 -15
  8. package/docs/custom-editor.html +92 -0
  9. package/docs/index.html +4 -1
  10. package/docs/meta_schema.json +426 -398
  11. package/package.json +1 -1
  12. package/src/defaults.js +15 -1
  13. package/src/editor.js +23 -6
  14. package/src/editors/multiple.js +76 -8
  15. package/src/editors/object.js +0 -1
  16. package/src/iconlibs/bootstrap.js +28 -0
  17. package/src/iconlibs/index.js +2 -0
  18. package/src/resolvers.js +5 -2
  19. package/src/schemaloader.js +3 -1
  20. package/src/themes/bootstrap3.js +1 -1
  21. package/src/utilities.js +32 -0
  22. package/src/validator.js +93 -0
  23. package/tests/codeceptjs/constrains/contains_test.js +36 -0
  24. package/tests/codeceptjs/constrains/dependentSchemas_test.js +15 -0
  25. package/tests/codeceptjs/constrains/if-then-else_test.js +186 -0
  26. package/tests/codeceptjs/core_test.js +35 -27
  27. package/tests/codeceptjs/editors/advanced_test.js +11 -10
  28. package/tests/codeceptjs/editors/array_any_of_test.js +35 -35
  29. package/tests/codeceptjs/editors/array_test.js +757 -767
  30. package/tests/codeceptjs/editors/autocomplete_test.js +1 -3
  31. package/tests/codeceptjs/editors/button_test.js +25 -24
  32. package/tests/codeceptjs/editors/checkbox_test.js +17 -16
  33. package/tests/codeceptjs/editors/colorpicker_test.js +18 -16
  34. package/tests/codeceptjs/editors/datetime_test.js +7 -7
  35. package/tests/codeceptjs/editors/inheritance_test.js +7 -8
  36. package/tests/codeceptjs/editors/integer_test.js +71 -72
  37. package/tests/codeceptjs/editors/jodit_test.js +16 -17
  38. package/tests/codeceptjs/editors/multiselect_test.js +5 -5
  39. package/tests/codeceptjs/editors/number_test.js +64 -65
  40. package/tests/codeceptjs/editors/object_test.js +39 -13
  41. package/tests/codeceptjs/editors/option-no_default_values_test.js +4 -4
  42. package/tests/codeceptjs/editors/programmatic-changes_test.js +2 -3
  43. package/tests/codeceptjs/editors/range_test.js +1 -3
  44. package/tests/codeceptjs/editors/select_test.js +3 -5
  45. package/tests/codeceptjs/editors/stepper_test.js +5 -7
  46. package/tests/codeceptjs/editors/string_test.js +8 -8
  47. package/tests/codeceptjs/editors/table-confirm-delete_test.js +7 -9
  48. package/tests/codeceptjs/editors/uuid_test.js +10 -10
  49. package/tests/codeceptjs/editors/validation_test.js +1 -1
  50. package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1133_test.js +1 -3
  51. package/tests/codeceptjs/issues/issue-gh-1158-2_test.js +10 -0
  52. package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1158_test.js +0 -2
  53. package/tests/codeceptjs/issues/issue-gh-1164_test.js +10 -0
  54. package/tests/codeceptjs/issues/issue-gh-1211_test.js +17 -0
  55. package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1257_test.js +2 -4
  56. package/tests/codeceptjs/issues/issue-gh-1338_test.js +16 -0
  57. package/tests/codeceptjs/issues/issue-gh-1347_test.js +8 -0
  58. package/tests/codeceptjs/issues/issue-gh-795_test.js +13 -0
  59. package/tests/codeceptjs/issues/issue-gh-810_test.js +52 -0
  60. package/tests/codeceptjs/issues/issue-gh-812_test.js +25 -0
  61. package/tests/codeceptjs/meta-schema_test.js +10 -10
  62. package/tests/codeceptjs/schemaloader_test.js +7 -7
  63. package/tests/codeceptjs/themes_test.js +31 -0
  64. package/tests/pages/autocomplete.html +1 -0
  65. package/tests/pages/contains.html +38 -0
  66. package/tests/pages/dependentSchemas.html +52 -0
  67. package/tests/pages/if-else.html +57 -0
  68. package/tests/pages/if-then-else-allOf.html +117 -0
  69. package/tests/pages/if-then-else-disable-fields.html +69 -0
  70. package/tests/pages/if-then-else.html +64 -0
  71. package/tests/pages/if-then.html +57 -0
  72. package/tests/pages/issues/issue-gh-1158-2.html +189 -0
  73. package/tests/pages/issues/issue-gh-1165.html +63 -0
  74. package/tests/pages/issues/issue-gh-1165.json +8 -0
  75. package/tests/pages/issues/issue-gh-1211.html +1022 -0
  76. package/tests/pages/issues/issue-gh-1338.html +74 -0
  77. package/tests/pages/issues/issue-gh-1347.html +142 -0
  78. package/tests/pages/issues/issue-gh-795.html +58 -0
  79. package/tests/pages/issues/issue-gh-810.html +149 -0
  80. package/tests/pages/keep_only_existing_values.html +80 -0
  81. package/tests/pages/maxContains.html +39 -0
  82. package/tests/pages/meta-schema.html +28 -0
  83. package/tests/pages/meta_schema.json +426 -398
  84. package/tests/pages/minContains.html +39 -0
  85. package/tests/pages/option-dependencies.html +106 -0
  86. package/tests/pages/themes.html +3 -1
  87. package/tests/unit/core.spec.js +2 -5
  88. package/tests/codeceptjs/editors/issues/issue-gh-1164_test.js +0 -12
  89. package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +0 -32
@@ -0,0 +1,186 @@
1
+ /* global Feature Scenario */
2
+
3
+ Feature('if-then-else')
4
+
5
+ Scenario('validate agaist allOf of if schemas @if-then-else', async ({ I }) => {
6
+ I.amOnPage('if-then-else-allOf.html')
7
+ I.waitForElement('.je-ready')
8
+
9
+ I.selectOption('[name="root[country]"]', 'United States of America')
10
+ I.waitForText('Value must match the pattern [0-9]{5}(-[0-9]{4})?.')
11
+
12
+ I.selectOption('[name="root[country]"]', 'Canada')
13
+ I.waitForText('Value must match the pattern [A-Z][0-9][A-Z] [0-9][A-Z][0-9].')
14
+
15
+ I.selectOption('[name="root[country]"]', 'Netherlands')
16
+ I.waitForText('Value must match the pattern [0-9]{4} [A-Z]{2}.')
17
+
18
+ I.fillField('#value', JSON.stringify({
19
+ street_address: '1600 Pennsylvania Avenue NW',
20
+ country: 'United States of America',
21
+ postal_code: '20500'
22
+ }))
23
+ I.click('#set-value')
24
+ I.dontSee('.invalid-feedback')
25
+
26
+ I.fillField('#value', JSON.stringify({
27
+ street_address: '1600 Pennsylvania Avenue NW',
28
+ postal_code: '20500'
29
+ }))
30
+ I.click('#set-value')
31
+ I.dontSee('.invalid-feedback')
32
+
33
+ I.fillField('#value', JSON.stringify({
34
+ street_address: '24 Sussex Drive',
35
+ country: 'Canada',
36
+ postal_code: 'K1M 1M4'
37
+ }))
38
+ I.click('#set-value')
39
+ I.dontSee('.invalid-feedback')
40
+
41
+ I.fillField('#value', JSON.stringify({
42
+ street_address: 'Adriaan Goekooplaan',
43
+ country: 'Netherlands',
44
+ postal_code: '2517 JX'
45
+ }))
46
+ I.click('#set-value')
47
+ I.dontSee('.invalid-feedback')
48
+
49
+ I.fillField('#value', JSON.stringify({
50
+ street_address: '24 Sussex Drive',
51
+ country: 'Canada',
52
+ postal_code: '10000'
53
+ }))
54
+ I.click('#set-value')
55
+ I.waitForText('Value must match the pattern [A-Z][0-9][A-Z] [0-9][A-Z][0-9].')
56
+ I.waitForElement('.invalid-feedback')
57
+
58
+ I.fillField('#value', JSON.stringify({
59
+ street_address: '1600 Pennsylvania Avenue NW',
60
+ postal_code: 'K1M 1M4'
61
+ }))
62
+ I.click('#set-value')
63
+ I.waitForElement('.invalid-feedback')
64
+ })
65
+
66
+ Scenario('validate agaist if-then-else @if-then-else', async ({ I }) => {
67
+ I.amOnPage('if-then-else.html')
68
+ I.waitForElement('.je-ready')
69
+
70
+ I.selectOption('[name="root[country]"]', 'America')
71
+ I.waitForElement('[name="root[postal_code]"]')
72
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
73
+ I.pressKey('Tab')
74
+ I.waitForElement('.invalid-feedback')
75
+ I.waitForText('Value must match the pattern [0-9]{5}(-[0-9]{4})?.')
76
+
77
+ I.selectOption('[name="root[country]"]', 'Canada')
78
+ I.waitForElement('[name="root[postal_code]"]')
79
+ I.fillField('[name="root[postal_code]"]', '10000')
80
+ I.pressKey('Tab')
81
+ I.waitForElement('.invalid-feedback')
82
+ I.waitForText('Value must match the pattern [A-Z][0-9][A-Z] [0-9][A-Z][0-9].')
83
+
84
+ I.selectOption('[name="root[country]"]', 'America')
85
+ I.waitForElement('[name="root[postal_code]"]')
86
+ I.fillField('[name="root[postal_code]"]', '10000')
87
+ I.pressKey('Tab')
88
+ I.dontSee('.invalid-feedback')
89
+
90
+ I.selectOption('[name="root[country]"]', 'Canada')
91
+ I.waitForElement('[name="root[postal_code]"]')
92
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
93
+ I.pressKey('Tab')
94
+ I.dontSee('.invalid-feedback')
95
+ })
96
+
97
+ Scenario('validate agaist if-then @if-then-else', async ({ I }) => {
98
+ I.amOnPage('if-then.html')
99
+ I.waitForElement('.je-ready')
100
+
101
+ I.selectOption('[name="root[country]"]', 'America')
102
+ I.waitForElement('[name="root[postal_code]"]')
103
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
104
+ I.pressKey('Tab')
105
+ I.waitForElement('.invalid-feedback')
106
+ I.waitForText('Value must match the pattern [0-9]{5}(-[0-9]{4})?.')
107
+
108
+ I.selectOption('[name="root[country]"]', 'Canada')
109
+ I.waitForElement('[name="root[postal_code]"]')
110
+ I.fillField('[name="root[postal_code]"]', '10000')
111
+ I.pressKey('Tab')
112
+ I.dontSee('.invalid-feedback')
113
+
114
+ I.selectOption('[name="root[country]"]', 'America')
115
+ I.waitForElement('[name="root[postal_code]"]')
116
+ I.fillField('[name="root[postal_code]"]', '10000')
117
+ I.pressKey('Tab')
118
+ I.dontSee('.invalid-feedback')
119
+
120
+ I.selectOption('[name="root[country]"]', 'Canada')
121
+ I.waitForElement('[name="root[postal_code]"]')
122
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
123
+ I.pressKey('Tab')
124
+ I.dontSee('.invalid-feedback')
125
+ })
126
+
127
+ Scenario('validate agaist if-else @if-then-else', async ({ I }) => {
128
+ I.amOnPage('if-else.html')
129
+ I.waitForElement('.je-ready')
130
+
131
+ I.selectOption('[name="root[country]"]', 'America')
132
+ I.waitForElement('[name="root[postal_code]"]')
133
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
134
+ I.pressKey('Tab')
135
+ I.dontSee('.invalid-feedback')
136
+
137
+ I.selectOption('[name="root[country]"]', 'Canada')
138
+ I.waitForElement('[name="root[postal_code]"]')
139
+ I.fillField('[name="root[postal_code]"]', '10000')
140
+ I.pressKey('Tab')
141
+ I.waitForElement('.invalid-feedback')
142
+ I.waitForText('Value must match the pattern [A-Z][0-9][A-Z] [0-9][A-Z][0-9].')
143
+
144
+ I.selectOption('[name="root[country]"]', 'America')
145
+ I.waitForElement('[name="root[postal_code]"]')
146
+ I.fillField('[name="root[postal_code]"]', '10000')
147
+ I.pressKey('Tab')
148
+ I.dontSee('.invalid-feedback')
149
+
150
+ I.selectOption('[name="root[country]"]', 'Canada')
151
+ I.waitForElement('[name="root[postal_code]"]')
152
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
153
+ I.pressKey('Tab')
154
+ I.dontSee('.invalid-feedback')
155
+ })
156
+
157
+ Scenario('validate agaist if-then-else when disabled fields are present in fields @if-then-else', async ({ I }) => {
158
+ I.amOnPage('if-then-else-disable-fields.html')
159
+ I.waitForElement('.je-ready')
160
+
161
+ I.selectOption('[name="root[country]"]', 'America')
162
+ I.waitForElement('[name="root[postal_code]"]')
163
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
164
+ I.pressKey('Tab')
165
+ I.waitForElement('.invalid-feedback')
166
+ I.waitForText('Value must match the pattern [0-9]{5}(-[0-9]{4})?.')
167
+
168
+ I.selectOption('[name="root[country]"]', 'Canada')
169
+ I.waitForElement('[name="root[postal_code]"]')
170
+ I.fillField('[name="root[postal_code]"]', '10000')
171
+ I.pressKey('Tab')
172
+ I.waitForElement('.invalid-feedback')
173
+ I.waitForText('Value must match the pattern [A-Z][0-9][A-Z] [0-9][A-Z][0-9].')
174
+
175
+ I.selectOption('[name="root[country]"]', 'America')
176
+ I.waitForElement('[name="root[postal_code]"]')
177
+ I.fillField('[name="root[postal_code]"]', '10000')
178
+ I.pressKey('Tab')
179
+ I.dontSee('.invalid-feedback')
180
+
181
+ I.selectOption('[name="root[country]"]', 'Canada')
182
+ I.waitForElement('[name="root[postal_code]"]')
183
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
184
+ I.pressKey('Tab')
185
+ I.dontSee('.invalid-feedback')
186
+ })
@@ -1,6 +1,6 @@
1
1
  /* global Feature Scenario */
2
2
 
3
- var assert = require('assert')
3
+ const assert = require('assert')
4
4
  const { DEFAULT_WAIT_TIME } = require('./test-config')
5
5
 
6
6
  Feature('core')
@@ -65,18 +65,18 @@ Scenario('should destroy', async ({ I }) => {
65
65
  Scenario('should set and get form value', async ({ I }) => {
66
66
  I.amOnPage('core.html')
67
67
  I.click('.get-value')
68
- assert.equal(await I.grabValueFrom('.value'), '{"age":18,"name":"Francesco Avizzano"}')
68
+ I.waitForValue('.value', '{"age":18,"name":"Francesco Avizzano"}')
69
69
  I.click('.set-value')
70
70
  I.click('.get-value')
71
- assert.equal(await I.grabValueFrom('.value'), '{"age":40,"name":"John Smith"}')
71
+ I.waitForValue('.value', '{"age":40,"name":"John Smith"}')
72
72
  })
73
73
 
74
74
  Scenario('should set and get individual values', async ({ I }) => {
75
75
  I.amOnPage('core.html')
76
76
  I.click('.get-individual-value')
77
- assert.equal(await I.grabValueFrom('.value'), '"Francesco Avizzano"')
77
+ I.waitForValue('.value', '"Francesco Avizzano"')
78
78
  I.click('.set-individual-value')
79
- assert.equal(await I.grabValueFrom('.value'), '"john kaminski"')
79
+ I.waitForValue('.value', '"john kaminski"')
80
80
  })
81
81
 
82
82
  Scenario('should watch a specific field for changes', async ({ I }) => {
@@ -116,9 +116,9 @@ Scenario('should change the form if form_name_root option is set @core', async (
116
116
  I.click('[for="form_2[1]"]')
117
117
  I.dontSee('Property must be set.', '.invalid-feedback')
118
118
  I.click('#get-value-form-1')
119
- assert.equal(await I.grabValueFrom('#value-form-1'), '"yes"')
119
+ I.waitForValue('#value-form-1', '"yes"')
120
120
  I.click('#get-value-form-2')
121
- assert.equal(await I.grabValueFrom('#value-form-2'), '"no"')
121
+ I.waitForValue('#value-form-2', '"no"')
122
122
  })
123
123
 
124
124
  Scenario('should validate against oneOf schemas and display single oneOf and editors error messages @core @oneof', async ({ I }) => {
@@ -170,6 +170,14 @@ Scenario('should validate against anyOf schemas and display single anyOf and edi
170
170
  I.dontSee('Property must be set.', '[data-schemapath="root.age"] .invalid-feedback')
171
171
  })
172
172
 
173
+ Scenario('should keep only existent values @core @anyof @keep_only_existing_values', async ({ I }) => {
174
+ I.amOnPage('keep_only_existing_values.html')
175
+ I.waitForElement('.je-ready')
176
+ I.waitForValue('#value', '{"name":"Afred","surname":"hitchcock","zip":"12345"}')
177
+ I.selectOption('.je-switcher', 'object 2')
178
+ I.waitForValue('#value', '{"name":"Afred","surname":"hitchcock","other_zip":""}')
179
+ })
180
+
173
181
  Scenario('should display anyOf and oneOf error messages in the correct places @848', async ({ I }) => {
174
182
  I.amOnPage('issues/issue-gh-848.html')
175
183
  I.selectOption('.je-switcher', 'Value, string')
@@ -182,69 +190,69 @@ Scenario('Should switch between all json 7 data types in @oneof and display erro
182
190
  I.waitForElement('.je-ready')
183
191
 
184
192
  I.selectOption('.je-switcher', 'Value, string')
185
- assert.equal(await I.grabValueFrom('#value'), '{"test":""}')
193
+ I.waitForValue('#value', '{"test":""}')
186
194
  I.waitForText('Value must validate against exactly one of the provided schemas.')
187
195
  I.waitForText('Value must be the constant value')
188
196
 
189
197
  I.selectOption('.je-switcher', 'Value, boolean')
190
- assert.equal(await I.grabValueFrom('#value'), '{"test":false}')
198
+ I.waitForValue('#value', '{"test":false}')
191
199
  I.waitForText('Value must validate against exactly one of the provided schemas.')
192
200
  I.waitForText('Value must be the constant value')
193
201
 
194
202
  I.selectOption('.je-switcher', 'Value, array')
195
- assert.equal(await I.grabValueFrom('#value'), '{"test":[]}')
203
+ I.waitForValue('#value', '{"test":[]}')
196
204
  I.waitForText('Value must validate against exactly one of the provided schemas.')
197
205
  I.waitForText('Value must be the constant value')
198
206
 
199
207
  I.selectOption('.je-switcher', 'Value, object')
200
- assert.equal(await I.grabValueFrom('#value'), '{"test":{}}')
208
+ I.waitForValue('#value', '{"test":{}}')
201
209
  I.waitForText('Value must validate against exactly one of the provided schemas.')
202
210
  I.waitForText('Value must be the constant value')
203
211
  I.waitForText('Object is missing the required property \'test\'')
204
212
 
205
213
  I.selectOption('.je-switcher', 'Value, number')
206
- assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
214
+ I.waitForValue('#value', '{"test":0}')
207
215
  I.waitForText('Value must validate against exactly one of the provided schemas.')
208
216
  I.waitForText('Value must be the constant value')
209
217
 
210
218
  I.selectOption('.je-switcher', 'Value, integer')
211
- assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
219
+ I.waitForValue('#value', '{"test":0}')
212
220
  I.waitForText('Value must validate against exactly one of the provided schemas.')
213
221
  I.waitForText('Value must be the constant value')
214
222
 
215
223
  I.selectOption('.je-switcher', 'Value, null')
216
- assert.equal(await I.grabValueFrom('#value'), '{"test":null}')
224
+ I.waitForValue('#value', '{"test":null}')
217
225
  })
218
226
 
219
- Scenario('Should switch between all json 7 data types in @anyof and display error messages for each one @core', async ({ I }) => {
227
+ Scenario('Should switch between all json 7 data types in @anyof and display error messages for each one @core', ({ I }) => {
220
228
  I.amOnPage('anyof-2.html')
221
229
  I.waitForElement('.je-ready')
222
230
 
223
- assert.equal(await I.grabValueFrom('#value'), '{"test":""}')
231
+ I.waitForValue('#value', '{"test":""}')
224
232
  I.waitForText('Value must validate against at least one of the provided schemas')
225
233
 
226
234
  I.selectOption('.je-switcher', 'Value, boolean')
227
- assert.equal(await I.grabValueFrom('#value'), '{"test":false}')
235
+ I.waitForValue('#value', '{"test":false}')
228
236
  I.waitForText('Value must validate against at least one of the provided schemas')
229
237
 
230
238
  I.selectOption('.je-switcher', 'Value, array')
231
- assert.equal(await I.grabValueFrom('#value'), '{"test":[]}')
239
+ I.waitForValue('#value', '{"test":[]}')
232
240
  I.waitForText('Value must validate against at least one of the provided schemas')
233
241
 
234
242
  I.selectOption('.je-switcher', 'Value, object')
235
- assert.equal(await I.grabValueFrom('#value'), '{"test":{}}')
243
+ I.waitForValue('#value', '{"test":{}}')
236
244
  I.waitForText('Value must validate against at least one of the provided schemas')
237
245
 
238
246
  I.selectOption('.je-switcher', 'Value, number')
239
- assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
247
+ I.waitForValue('#value', '{"test":0}')
240
248
  I.waitForText('Value must validate against at least one of the provided schemas')
241
249
 
242
250
  I.selectOption('.je-switcher', 'Value, integer')
243
- assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
251
+ I.waitForValue('#value', '{"test":0}')
244
252
  I.waitForText('Value must validate against at least one of the provided schemas')
245
253
 
246
254
  I.selectOption('.je-switcher', 'Value, null')
247
- assert.equal(await I.grabValueFrom('#value'), '{"test":null}')
255
+ I.waitForValue('#value', '{"test":null}')
248
256
  })
249
257
 
250
258
  Scenario('should validate against oneOf schemas and display single oneOf and editors error messages @core @translate-property', async ({ I }) => {
@@ -346,17 +354,17 @@ Scenario('should load internal schema definitions, external schema definitions a
346
354
  '../fixtures/string.json',
347
355
  '../fixtures/definitions.json',
348
356
  '../fixtures/basic_person.json',
349
- '../fixtures/person.json',
357
+ '../fixtures/person.json'
350
358
  ]
351
359
  for (const path of schemaPaths) {
352
- let key = 'je-cache::' + currentPath + path;
360
+ const key = 'je-cache::' + currentPath + path
353
361
 
354
362
  const item = await I.executeScript(function (storageKey) {
355
- return window.localStorage.getItem(storageKey);
363
+ return window.localStorage.getItem(storageKey)
356
364
  }, key)
357
365
  const itemDecoded = JSON.parse(item)
358
- assert.equal(itemDecoded.cacheBuster, 'abc123');
359
- assert(itemDecoded, 'Cached schema found');
366
+ assert.strictEqual(itemDecoded.cacheBuster, 'abc123')
367
+ assert(itemDecoded, 'Cached schema found')
360
368
  }
361
369
  })
362
370
 
@@ -1,13 +1,14 @@
1
+ /* global Feature Scenario */
1
2
 
2
- Feature('Advanced Editor');
3
+ Feature('Advanced Editor')
3
4
 
4
5
  Scenario('test validation & delete', ({ I }) => {
5
- I.amOnPage('advanced.html');
6
- I.retry({ retries: 5, minTimeout: 500 }).seeElement('#valid_indicator');
7
- I.see('valid', '#valid_indicator');
8
- I.fillField('root[0][location][city]', 'Stuttgart');
9
- I.waitForValue("[name='root[0][location][city]']", 'Stuttgart');
10
- I.amAcceptingPopups();
11
- I.click('.json-editor-btntype-deletelast');
12
- I.acceptPopup();
13
- });
6
+ I.amOnPage('advanced.html')
7
+ I.retry({ retries: 5, minTimeout: 500 }).seeElement('#valid_indicator')
8
+ I.see('valid', '#valid_indicator')
9
+ I.fillField('root[0][location][city]', 'Stuttgart')
10
+ I.waitForValue("[name='root[0][location][city]']", 'Stuttgart')
11
+ I.amAcceptingPopups()
12
+ I.click('.json-editor-btntype-deletelast')
13
+ I.acceptPopup()
14
+ })
@@ -1,50 +1,50 @@
1
- var assert = require('assert');
1
+ /* global Feature Scenario */
2
2
 
3
- Feature('anyof in array');
3
+ const assert = require('assert')
4
+ let value
5
+
6
+ Feature('anyof in array')
4
7
 
5
8
  Scenario('should have correct initial value', async ({ I }) => {
6
- I.amOnPage('array-anyof.html');
7
- I.click('.get-value');
8
- assert.equal(await I.grabValueFrom('.debug'), '{"correct":"","items":[]}');
9
- });
9
+ I.amOnPage('array-anyof.html')
10
+ I.click('.get-value')
11
+ I.waitForValue('.debug', '{"correct":"","items":[]}')
12
+ })
10
13
 
11
14
  Scenario('should show errors @optional', async ({ I }) => {
12
- I.amOnPage('array-anyof.html');
13
- I.seeElement('[data-schemapath="root"]');
14
- I.seeElement('[data-schemapath="root.items"]');
15
+ I.amOnPage('array-anyof.html')
16
+ I.seeElement('[data-schemapath="root"]')
17
+ I.seeElement('[data-schemapath="root.items"]')
15
18
 
16
- I.click('.get-value');
17
- value = await I.grabValueFrom('.debug');
18
- assert.equal(value, '{"correct":"","items":[]}');
19
+ I.click('.get-value')
20
+ I.waitForValue('.debug', '{"correct":"","items":[]}')
19
21
 
20
- I.fillField('root[correct]', 'a');
21
- assert.equal(await I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.'), true, 'should show warning');
22
+ I.fillField('root[correct]', 'a')
23
+ assert.strictEqual(await I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.'), true, 'should show warning')
22
24
 
23
- I.fillField('root[correct]', 'a!');
24
- assert.equal(await I.seeInField('root[correct]', 'a!'), true, 'fillField failed');
25
- assert.equal(await I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.'), true, 'should show warning');
25
+ I.fillField('root[correct]', 'a!')
26
+ assert.strictEqual(await I.seeInField('root[correct]', 'a!'), true, 'fillField failed')
27
+ assert.strictEqual(await I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.'), true, 'should show warning')
26
28
 
27
- I.clearField('root[correct]');
28
- I.seeInField('root[correct]', '');
29
- assert.equal(await I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.'), true, "should show warning");
29
+ I.clearField('root[correct]')
30
+ I.seeInField('root[correct]', '')
31
+ assert.strictEqual(await I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.'), true, 'should show warning')
30
32
 
31
- I.fillField('root[correct]', 'a');
32
- I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.');
33
+ I.fillField('root[correct]', 'a')
34
+ I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.')
33
35
 
34
- I.click('.json-editor-btntype-add');
35
- I.click('.get-value');
36
- value = await I.grabValueFrom('.debug');
37
- assert.equal(value, '{"correct":"a","items":[{"handler":"aaa","id":"","___a":""}]}');
36
+ I.click('.json-editor-btntype-add')
37
+ I.click('.get-value')
38
+ I.waitForValue('.debug', '{"correct":"a","items":[{"handler":"aaa","id":"","___a":""}]}')
38
39
 
39
- I.fillField('root[items][0][id]', 'a');
40
- I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.');
40
+ I.fillField('root[items][0][id]', 'a')
41
+ I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.')
41
42
 
42
- I.clearField('root[items][0][id]');
43
- I.seeInField('root[items][0][id]', '');
43
+ I.clearField('root[items][0][id]')
44
+ I.seeInField('root[items][0][id]', '')
44
45
  // todo still not work
45
- assert.equal(await I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.'), true, 'should show warning');
46
-
47
- I.fillField('root[items][0][id]', 'a!');
48
- I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.');
46
+ assert.strictEqual(await I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.'), true, 'should show warning')
49
47
 
50
- });
48
+ I.fillField('root[items][0][id]', 'a!')
49
+ I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.')
50
+ })