@json-editor/json-editor 2.9.0-beta.0 → 2.9.0

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 (58) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/README.md +16 -7
  3. package/dist/jsoneditor.js +2 -2
  4. package/dist/jsoneditor.js.LICENSE.txt +15 -0
  5. package/dist/jsoneditor.js.map +1 -0
  6. package/dist/nonmin/jsoneditor.js +989 -127
  7. package/dist/nonmin/jsoneditor.js.map +1 -1
  8. package/docs/index.html +22 -10
  9. package/docs/meta_schema.json +3 -2
  10. package/docs/starrating.html +2 -6
  11. package/package.json +4 -2
  12. package/src/defaults.js +9 -1
  13. package/src/editor.js +17 -3
  14. package/src/editors/array.js +7 -4
  15. package/src/editors/multiselect.js +1 -0
  16. package/src/editors/object.css +3 -3
  17. package/src/editors/object.css.js +1 -1
  18. package/src/editors/object.js +5 -2
  19. package/src/editors/table.js +11 -4
  20. package/src/editors/upload.js +3 -2
  21. package/src/themes/barebones.js +3 -1
  22. package/src/themes/bootstrap5.css +97 -0
  23. package/src/themes/bootstrap5.css.js +3 -0
  24. package/src/themes/bootstrap5.js +623 -0
  25. package/src/themes/index.js +2 -0
  26. package/src/themes/tailwind.js +2 -2
  27. package/tests/codeceptjs/core_test.js +107 -17
  28. package/tests/codeceptjs/editors/array_test.js +6 -5
  29. package/tests/codeceptjs/editors/button_test.js +7 -6
  30. package/tests/codeceptjs/editors/checkbox_test.js +3 -2
  31. package/tests/codeceptjs/editors/integer_test.js +3 -2
  32. package/tests/codeceptjs/editors/issues/issue-gh-1158_test.js +10 -0
  33. package/tests/codeceptjs/editors/issues/issue-gh-1257_test.js +13 -0
  34. package/tests/codeceptjs/editors/number_test.js +2 -1
  35. package/tests/codeceptjs/editors/object_test.js +39 -38
  36. package/tests/codeceptjs/editors/option-no_default_values_test.js +1 -1
  37. package/tests/codeceptjs/editors/programmatic-changes_test.js +3 -2
  38. package/tests/codeceptjs/editors/tabs_test.js +5 -3
  39. package/tests/codeceptjs/editors/validation_test.js +3 -1
  40. package/tests/codeceptjs/meta-schema_test.js +72 -4
  41. package/tests/codeceptjs/schemaloader_test.js +2 -1
  42. package/tests/codeceptjs/test-config.js +3 -0
  43. package/tests/codeceptjs/themes_test.js +14 -0
  44. package/tests/pages/anyof-2.html +90 -0
  45. package/tests/pages/anyof.html +1 -1
  46. package/tests/pages/container-attributes.html +50 -0
  47. package/tests/pages/issues/issue-gh-1158.html +50 -0
  48. package/tests/pages/issues/issue-gh-1233-failing.html +46 -0
  49. package/tests/pages/issues/issue-gh-1233-passing.html +49 -0
  50. package/tests/pages/issues/issue-gh-1257.html +77 -0
  51. package/tests/pages/meta-schema.html +747 -0
  52. package/tests/pages/meta_schema.json +3 -16
  53. package/tests/pages/oneof-2.html +90 -0
  54. package/tests/pages/per-editor-options.html +44 -0
  55. package/tests/pages/stepper.html +2 -2
  56. package/tests/pages/themes.html +2 -0
  57. /package/tests/pages/{table-move-events.html → array-events-table.html} +0 -0
  58. /package/tests/pages/{array-move-events.html → array-events.html} +0 -0
@@ -1,9 +1,27 @@
1
1
  /* global Feature Scenario */
2
2
 
3
3
  var assert = require('assert')
4
+ const { DEFAULT_WAIT_TIME } = require('./test-config')
4
5
 
5
6
  Feature('core')
6
7
 
8
+ Scenario('should set per-editor options @per-editor-options', async (I) => {
9
+ I.amOnPage('per-editor-options.html')
10
+ I.waitForElement('.je-ready')
11
+ I.waitForElement('[title="Expand"]')
12
+ I.dontSeeElement('[title="Collapse"]')
13
+ I.dontSeeElement('.card')
14
+ })
15
+
16
+ Scenario('should set container attributes @container-attributes', async (I) => {
17
+ I.amOnPage('container-attributes.html')
18
+ I.waitForElement('.je-ready')
19
+ I.waitForElement('.container-class')
20
+ I.dontSeeElement('[data-schematype="blank"]')
21
+ I.dontSeeElement('[data-schemapath="blank"]')
22
+ I.dontSeeElement('[data-schemaid="blank"]')
23
+ })
24
+
7
25
  Scenario('should not set inputs name attributes @use-name-attributes', async (I) => {
8
26
  I.amOnPage('use-name-attributes.html')
9
27
  I.waitForElement('.je-ready')
@@ -105,13 +123,14 @@ Scenario('should change the form if form_name_root option is set @core', async (
105
123
 
106
124
  Scenario('should validate against oneOf schemas and display single oneOf and editors error messages @core @oneof', async (I) => {
107
125
  I.amOnPage('oneof.html')
108
- I.waitForText('Object is missing the required property \'p4\'', '.alert-danger')
109
- I.waitForText('Value must validate against exactly one of the provided schemas. It currently validates against 0 of the schemas.', '.alert-danger')
110
- I.waitForText('Object is missing the required property \'p1\'', '.alert-danger')
111
- I.waitForText('Object is missing the required property \'p2\'', '.alert-danger')
112
- I.waitForText('Property must be set.', '[data-schemapath="root.p4"] .invalid-feedback')
113
- I.waitForText('Property must be set.', '[data-schemapath="root.p5.p1"] .invalid-feedback')
114
- I.waitForText('Property must be set.', '[data-schemapath="root.p5.p2"] .invalid-feedback')
126
+ I.waitForElement('.je-ready')
127
+ I.waitForText('Object is missing the required property \'p4\'', DEFAULT_WAIT_TIME, '.alert-danger')
128
+ I.waitForText('Value must validate against exactly one of the provided schemas. It currently validates against 0 of the schemas.', DEFAULT_WAIT_TIME, '.alert-danger')
129
+ I.waitForText('Object is missing the required property \'p1\'', DEFAULT_WAIT_TIME, '.alert-danger')
130
+ I.waitForText('Object is missing the required property \'p2\'', DEFAULT_WAIT_TIME, '.alert-danger')
131
+ I.waitForText('Property must be set.', DEFAULT_WAIT_TIME, '[data-schemapath="root.p4"] .invalid-feedback')
132
+ I.waitForText('Property must be set.', DEFAULT_WAIT_TIME, '[data-schemapath="root.p5.p1"] .invalid-feedback')
133
+ I.waitForText('Property must be set.', DEFAULT_WAIT_TIME, '[data-schemapath="root.p5.p2"] .invalid-feedback')
115
134
  I.fillField('root[p4]', 'to')
116
135
  I.fillField('root[p5][p1]', 'to')
117
136
  I.fillField('root[p5][p2]', 'to')
@@ -120,9 +139,9 @@ Scenario('should validate against oneOf schemas and display single oneOf and edi
120
139
  I.dontSee('Object is missing the required property \'p4\'', '.alert-danger')
121
140
  I.dontSee('Object is missing the required property \'p1\'', '.alert-danger')
122
141
  I.dontSee('Object is missing the required property \'p2\'', '.alert-danger')
123
- I.waitForText('Value must be at least 4 characters long.', '[data-schemapath="root.p4"] .invalid-feedback')
124
- I.waitForText('Value must be at least 4 characters long.', '[data-schemapath="root.p5.p1"] .invalid-feedback')
125
- I.waitForText('Value must be at least 4 characters long.', '[data-schemapath="root.p5.p2"] .invalid-feedback')
142
+ I.waitForText('Value must be at least 4 characters long.', DEFAULT_WAIT_TIME, '[data-schemapath="root.p4"] .invalid-feedback')
143
+ I.waitForText('Value must be at least 4 characters long.', DEFAULT_WAIT_TIME, '[data-schemapath="root.p5.p1"] .invalid-feedback')
144
+ I.waitForText('Value must be at least 4 characters long.', DEFAULT_WAIT_TIME, '[data-schemapath="root.p5.p2"] .invalid-feedback')
126
145
  I.fillField('root[p4]', 'todo')
127
146
  I.fillField('root[p5][p1]', 'todo')
128
147
  I.fillField('root[p5][p2]', 'todo')
@@ -135,14 +154,15 @@ Scenario('should validate against oneOf schemas and display single oneOf and edi
135
154
 
136
155
  Scenario('should validate against anyOf schemas and display single anyOf and editors error messages @core @anyof', async (I) => {
137
156
  I.amOnPage('anyof.html')
138
- I.dontSeeElement('.alert-danger')
157
+ I.waitForElement('.je-ready')
158
+ I.waitForElement('.alert-danger')
139
159
  I.selectOption('.je-switcher', 'Value, number')
140
- I.dontSeeElement('.alert-danger')
160
+ I.waitForElement('.alert-danger')
141
161
  I.selectOption('.je-switcher', 'Value, null')
142
- I.dontSeeElement('.alert-danger')
162
+ I.waitForElement('.alert-danger')
143
163
  I.selectOption('.je-switcher', 'Value, string')
144
- I.waitForText('Object is missing the required property \'age\'', '.alert-danger')
145
- I.waitForText('Property must be set.', '[data-schemapath="root.age"] .invalid-feedback')
164
+ I.waitForText('Object is missing the required property \'age\'', DEFAULT_WAIT_TIME, '.alert-danger')
165
+ I.waitForText('Property must be set.', DEFAULT_WAIT_TIME, '[data-schemapath="root.age"] .invalid-feedback')
146
166
  I.fillField('root[age]', 'to')
147
167
  I.click('Get Value')
148
168
  I.wait(3)
@@ -153,8 +173,78 @@ Scenario('should validate against anyOf schemas and display single anyOf and edi
153
173
  Scenario('should display anyOf and oneOf error messages in the correct places @848', async (I) => {
154
174
  I.amOnPage('issues/issue-gh-848.html')
155
175
  I.selectOption('.je-switcher', 'Value, string')
156
- I.waitForElement('[data-schemapath="root.list"] .invalid-feedback', 5)
157
- I.dontSeeElement('[data-schemapath="root.list_group"] .invalid-feedback', 5)
176
+ I.waitForElement('[data-schemapath="root.list"] .invalid-feedback', DEFAULT_WAIT_TIME)
177
+ I.dontSeeElement('[data-schemapath="root.list_group"] .invalid-feedback', DEFAULT_WAIT_TIME)
178
+ })
179
+
180
+ Scenario('Should switch between all json 7 data types in @oneof and display error messages for each one @core', async (I) => {
181
+ I.amOnPage('oneof-2.html')
182
+ I.waitForElement('.je-ready')
183
+
184
+ I.selectOption('.je-switcher', 'Value, string')
185
+ assert.equal(await I.grabValueFrom('#value'), '{"test":""}')
186
+ I.waitForText('Value must validate against exactly one of the provided schemas.')
187
+ I.waitForText('Value must be the constant value')
188
+
189
+ I.selectOption('.je-switcher', 'Value, boolean')
190
+ assert.equal(await I.grabValueFrom('#value'), '{"test":false}')
191
+ I.waitForText('Value must validate against exactly one of the provided schemas.')
192
+ I.waitForText('Value must be the constant value')
193
+
194
+ I.selectOption('.je-switcher', 'Value, array')
195
+ assert.equal(await I.grabValueFrom('#value'), '{"test":[]}')
196
+ I.waitForText('Value must validate against exactly one of the provided schemas.')
197
+ I.waitForText('Value must be the constant value')
198
+
199
+ I.selectOption('.je-switcher', 'Value, object')
200
+ assert.equal(await I.grabValueFrom('#value'), '{"test":{}}')
201
+ I.waitForText('Value must validate against exactly one of the provided schemas.')
202
+ I.waitForText('Value must be the constant value')
203
+ I.waitForText('Object is missing the required property \'test\'')
204
+
205
+ I.selectOption('.je-switcher', 'Value, number')
206
+ assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
207
+ I.waitForText('Value must validate against exactly one of the provided schemas.')
208
+ I.waitForText('Value must be the constant value')
209
+
210
+ I.selectOption('.je-switcher', 'Value, integer')
211
+ assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
212
+ I.waitForText('Value must validate against exactly one of the provided schemas.')
213
+ I.waitForText('Value must be the constant value')
214
+
215
+ I.selectOption('.je-switcher', 'Value, null')
216
+ assert.equal(await I.grabValueFrom('#value'), '{"test":null}')
217
+ })
218
+
219
+ Scenario('Should switch between all json 7 data types in @anyof and display error messages for each one @core', async (I) => {
220
+ I.amOnPage('anyof-2.html')
221
+ I.waitForElement('.je-ready')
222
+
223
+ assert.equal(await I.grabValueFrom('#value'), '{"test":""}')
224
+ I.waitForText('Value must validate against at least one of the provided schemas')
225
+
226
+ I.selectOption('.je-switcher', 'Value, boolean')
227
+ assert.equal(await I.grabValueFrom('#value'), '{"test":false}')
228
+ I.waitForText('Value must validate against at least one of the provided schemas')
229
+
230
+ I.selectOption('.je-switcher', 'Value, array')
231
+ assert.equal(await I.grabValueFrom('#value'), '{"test":[]}')
232
+ I.waitForText('Value must validate against at least one of the provided schemas')
233
+
234
+ I.selectOption('.je-switcher', 'Value, object')
235
+ assert.equal(await I.grabValueFrom('#value'), '{"test":{}}')
236
+ I.waitForText('Value must validate against at least one of the provided schemas')
237
+
238
+ I.selectOption('.je-switcher', 'Value, number')
239
+ assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
240
+ I.waitForText('Value must validate against at least one of the provided schemas')
241
+
242
+ I.selectOption('.je-switcher', 'Value, integer')
243
+ assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
244
+ I.waitForText('Value must validate against at least one of the provided schemas')
245
+
246
+ I.selectOption('.je-switcher', 'Value, null')
247
+ assert.equal(await I.grabValueFrom('#value'), '{"test":null}')
158
248
  })
159
249
 
160
250
  Scenario('should validate against oneOf schemas and display single oneOf and editors error messages @core @translate-property', async (I) => {
@@ -1,6 +1,7 @@
1
1
  /* global Feature Scenario */
2
2
 
3
3
  var assert = require('assert');
4
+ const { DEFAULT_WAIT_TIME } = require('../test-config')
4
5
 
5
6
  Feature('array');
6
7
 
@@ -12,7 +13,7 @@ Scenario('should have correct initial value', async (I) => {
12
13
 
13
14
  Scenario('unique items arrays sorting @unique-itmes-sorting', async (I) => {
14
15
  I.amOnPage('array-unique-items-sort.html')
15
- I.waitForElement('.je-ready', 10)
16
+ I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
16
17
  I.click('[data-schemapath="root.items"] .form-control:nth-of-type(1)')
17
18
  I.click('.get-value')
18
19
  assert.equal(await I.grabValueFrom('.debug'), '{"items":["01"]}')
@@ -60,8 +61,8 @@ Scenario('unique items arrays sorting @unique-itmes-sorting', async (I) => {
60
61
  assert.equal(await I.grabValueFrom('.debug'), '{"items":["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15"]}')
61
62
  });
62
63
 
63
- Scenario('should trigger array (table) editing triggers @retry', async (I) => {
64
- I.amOnPage('table-move-events.html');
64
+ Scenario('should array editor events (table) @array-events', async (I) => {
65
+ I.amOnPage('array-events-table.html');
65
66
  I.seeElement('[data-schemapath="root.0"]');
66
67
  I.seeElement('[data-schemapath="root.1"]');
67
68
  I.seeElement('[data-schemapath="root.2"]');
@@ -132,8 +133,8 @@ Scenario('should trigger array (table) editing triggers @retry', async (I) => {
132
133
  assert.equal(value, '[]');
133
134
  });
134
135
 
135
- Scenario('should array editing triggers', async (I) => {
136
- I.amOnPage('array-move-events.html');
136
+ Scenario('should array editor events @array-events', async (I) => {
137
+ I.amOnPage('array-events.html');
137
138
  I.seeElement('[data-schemapath="root.0"]');
138
139
  I.seeElement('[data-schemapath="root.1"]');
139
140
  I.click('.get-value');
@@ -1,10 +1,11 @@
1
1
  var assert = require('assert');
2
+ const { DEFAULT_WAIT_TIME } = require('../test-config')
2
3
 
3
4
  Feature('button');
4
5
 
5
6
  Scenario('should work with button editor callbacks', async (I) => {
6
7
  I.amOnPage('button-callbacks.html');
7
- I.waitForElement('.je-ready', 10)
8
+ I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
8
9
  I.seeElement('[data-schemapath="root.button1"] button');
9
10
  I.click('[data-schemapath="root.button1"] button');
10
11
  assert.equal(await I.grabValueFrom('.value'), 'button1CB');
@@ -12,7 +13,7 @@ Scenario('should work with button editor callbacks', async (I) => {
12
13
 
13
14
  Scenario('should work with option "validated"', async (I) => {
14
15
  I.amOnPage('button-callbacks.html');
15
- I.waitForElement('.je-ready', 10)
16
+ I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
16
17
  I.seeElement('[data-schemapath="root.button1"] button');
17
18
  I.retry({ retries: 3, minTimeout: 500 }).seeDisabledAttribute('[data-schemapath="root.button2"] button');
18
19
  await I.fillField('[name="root[textinput]"]', 'Hello World');
@@ -24,19 +25,19 @@ Scenario('should work with option "validated"', async (I) => {
24
25
 
25
26
  Scenario('should not leave any footprints in result', async (I) => {
26
27
  I.amOnPage('button-callbacks.html');
27
- I.waitForElement('.je-ready', 10)
28
+ I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
28
29
  I.click('.get-value');
29
30
  assert.equal(await I.grabValueFrom('.value'), JSON.stringify({"textinput":""}));
30
31
  });
31
32
 
32
33
  Scenario('should be disabled if "readonly" is specified', async (I) => {
33
34
  I.amOnPage('read-only.html');
34
- I.waitForElement('.je-ready', 10)
35
+ I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
35
36
  I.seeDisabledAttribute('[data-schemapath="root.button"] button');
36
37
  });
37
38
 
38
39
  Scenario('should set icon @button @button-icon', async (I) => {
39
40
  I.amOnPage('button-icons.html')
40
- I.waitForElement('.je-ready', 10)
41
- I.waitForElement('i.fas.fa-search', 10)
41
+ I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
42
+ I.waitForElement('i.fas.fa-search', DEFAULT_WAIT_TIME)
42
43
  });
@@ -1,16 +1,17 @@
1
1
  var assert = require('assert');
2
+ const { DEFAULT_WAIT_TIME } = require('../test-config')
2
3
 
3
4
  Feature('checkbox');
4
5
 
5
6
  Scenario('should be disabled if "readonly" is specified', async (I) => {
6
7
  I.amOnPage('read-only.html');
7
- I.waitForText('READY', 5, '.state');
8
+ I.waitForText('READY', DEFAULT_WAIT_TIME, '.state');
8
9
  I.seeDisabledAttribute('[name="root[checkbox]"]');
9
10
  });
10
11
 
11
12
  Scenario('label should be visible for items at top level, but not in tables', async (I) => {
12
13
  I.amOnPage('checkbox-labels.html');
13
- I.waitForText('READY', 5, '.state');
14
+ I.waitForText('READY', DEFAULT_WAIT_TIME, '.state');
14
15
  I.seeElement('//label[contains(@for, "root[Awesome Compact]")]');
15
16
  I.seeElement('//label[contains(@for, "root[Awesome Not Compact]")]');
16
17
  I.dontSeeElement('//label[contains(@for, "root[pets][0][Awesome in Object Table]")]');
@@ -1,4 +1,5 @@
1
1
  var assert = require('assert');
2
+ const { DEFAULT_WAIT_TIME } = require('../test-config')
2
3
 
3
4
  Feature('integer');
4
5
 
@@ -70,11 +71,11 @@ Scenario('should be readonly if specified and not disabled', async (I) => {
70
71
  Scenario('should update output when (method) setValue is called', async (I) => {
71
72
  I.amOnPage('integer.html');
72
73
  I.saveScreenshot('integer-setvalue-1.png')
73
- I.waitForText('5', 20, '[data-schemapath="root.integer_range"] output');
74
+ I.waitForText('5', DEFAULT_WAIT_TIME, '[data-schemapath="root.integer_range"] output');
74
75
  I.saveScreenshot('integer-setvalue-2.png')
75
76
  I.click('.set-value');
76
77
  I.saveScreenshot('integer-setvalue-3.png')
77
- I.waitForText('2', 20, '[data-schemapath="root.integer_range"] output');
78
+ I.waitForText('2', DEFAULT_WAIT_TIME, '[data-schemapath="root.integer_range"] output');
78
79
  I.saveScreenshot('integer-setvalue-4.png')
79
80
  });
80
81
 
@@ -0,0 +1,10 @@
1
+ /* global Feature Scenario */
2
+
3
+ const assert = require('assert')
4
+
5
+ Feature('issues')
6
+
7
+ Scenario('GitHub issue 1158 should remain fixed @issue-1158 @optional', async (I) => {
8
+ I.amOnPage('issues/issue-gh-1158.html')
9
+ I.seeElement('[name="root[name]"]')
10
+ })
@@ -0,0 +1,13 @@
1
+ /* global Feature Scenario */
2
+
3
+ const assert = require('assert')
4
+
5
+ Feature('GitHub issue 1257')
6
+
7
+ Scenario('GitHub issue 1257 should remain fixed @issue-1257', async (I) => {
8
+ I.amOnPage('issues/issue-gh-1257.html')
9
+ I.waitForElement('.je-ready')
10
+ I.click('[data-schemapath="root.colors"] .json-editor-btntype-add')
11
+ assert.equal(await I.grabValueFrom('#value'), '{"colors":[{"text":"X","color":"#fefaac"}],"color":"#fefaac"}')
12
+ assert.equal(await I.grabValueFrom('[name="root[colors][0][color]"]'), '#fefaac')
13
+ })
@@ -1,4 +1,5 @@
1
1
  var assert = require('assert');
2
+ const { DEFAULT_WAIT_TIME } = require('../test-config')
2
3
 
3
4
  Feature('number');
4
5
 
@@ -12,7 +13,7 @@ Scenario('should validate value', async (I) => {
12
13
  I.amOnPage('number.html');
13
14
  await I.fillField('[name="root[number]"]', '12-12');
14
15
  I.click('.get-value');
15
- I.waitForText('Value must be of type number.', 5, '[data-schemapath="root.number"] .invalid-feedback');
16
+ I.waitForText('Value must be of type number.', DEFAULT_WAIT_TIME, '[data-schemapath="root.number"] .invalid-feedback');
16
17
  assert.equal(await I.grabValueFrom('.value'), '{"number":"12-12","number_number":5.75,"number_range":5.75}');
17
18
  });
18
19
 
@@ -1,6 +1,7 @@
1
1
  /* global Feature Scenario */
2
2
 
3
3
  const assert = require('assert')
4
+ const { DEFAULT_WAIT_TIME } = require('../test-config')
4
5
 
5
6
  Feature('object')
6
7
 
@@ -142,16 +143,16 @@ Scenario('set value opt in optional properties @show_opt_in', async (I) => {
142
143
  I.amOnPage('object-required-properties.html')
143
144
 
144
145
  // all editors visible
145
- I.waitForElement('[data-schemapath="root.string"]', 5)
146
- I.waitForElement('[data-schemapath="root.number"]', 5)
147
- I.waitForElement('[data-schemapath="root.boolean"]', 5)
148
- I.waitForElement('[data-schemapath="root.radio"]', 5)
149
- I.waitForElement('[data-schemapath="root.array"]', 5)
150
- I.waitForElement('[data-schemapath="root.object"]', 5)
151
- I.waitForElement('[data-schemapath="root.object.string"]', 5)
152
- I.waitForElement('[data-schemapath="root.object.number"]', 5)
153
- I.waitForElement('[data-schemapath="root.object.boolean"]', 5)
154
- I.waitForElement('[data-schemapath="root.object.radio"]', 5)
146
+ I.waitForElement('[data-schemapath="root.string"]', DEFAULT_WAIT_TIME)
147
+ I.waitForElement('[data-schemapath="root.number"]', DEFAULT_WAIT_TIME)
148
+ I.waitForElement('[data-schemapath="root.boolean"]', DEFAULT_WAIT_TIME)
149
+ I.waitForElement('[data-schemapath="root.radio"]', DEFAULT_WAIT_TIME)
150
+ I.waitForElement('[data-schemapath="root.array"]', DEFAULT_WAIT_TIME)
151
+ I.waitForElement('[data-schemapath="root.object"]', DEFAULT_WAIT_TIME)
152
+ I.waitForElement('[data-schemapath="root.object.string"]', DEFAULT_WAIT_TIME)
153
+ I.waitForElement('[data-schemapath="root.object.number"]', DEFAULT_WAIT_TIME)
154
+ I.waitForElement('[data-schemapath="root.object.boolean"]', DEFAULT_WAIT_TIME)
155
+ I.waitForElement('[data-schemapath="root.object.radio"]', DEFAULT_WAIT_TIME)
155
156
 
156
157
  // set values
157
158
  I.click('.set-value')
@@ -164,29 +165,29 @@ Scenario('set value opt in optional properties @show_opt_in', async (I) => {
164
165
  assert.equal(await I.grabValueFrom('.value'), '{"number":0,"boolean":false}')
165
166
 
166
167
  // all editorsstill visible
167
- I.waitForElement('[data-schemapath="root.string"]', 5)
168
- I.waitForElement('[data-schemapath="root.number"]', 5)
169
- I.waitForElement('[data-schemapath="root.boolean"]', 5)
170
- I.waitForElement('[data-schemapath="root.radio"]', 5)
171
- I.waitForElement('[data-schemapath="root.array"]', 5)
172
- I.waitForElement('[data-schemapath="root.object"]', 5)
173
- I.waitForElement('[data-schemapath="root.object.string"]', 5)
174
- I.waitForElement('[data-schemapath="root.object.number"]', 5)
175
- I.waitForElement('[data-schemapath="root.object.boolean"]', 5)
176
- I.waitForElement('[data-schemapath="root.object.radio"]', 5)
168
+ I.waitForElement('[data-schemapath="root.string"]', DEFAULT_WAIT_TIME)
169
+ I.waitForElement('[data-schemapath="root.number"]', DEFAULT_WAIT_TIME)
170
+ I.waitForElement('[data-schemapath="root.boolean"]', DEFAULT_WAIT_TIME)
171
+ I.waitForElement('[data-schemapath="root.radio"]', DEFAULT_WAIT_TIME)
172
+ I.waitForElement('[data-schemapath="root.array"]', DEFAULT_WAIT_TIME)
173
+ I.waitForElement('[data-schemapath="root.object"]', DEFAULT_WAIT_TIME)
174
+ I.waitForElement('[data-schemapath="root.object.string"]', DEFAULT_WAIT_TIME)
175
+ I.waitForElement('[data-schemapath="root.object.number"]', DEFAULT_WAIT_TIME)
176
+ I.waitForElement('[data-schemapath="root.object.boolean"]', DEFAULT_WAIT_TIME)
177
+ I.waitForElement('[data-schemapath="root.object.radio"]', DEFAULT_WAIT_TIME)
177
178
  })
178
179
 
179
180
  Scenario('set value opt in optional properties @show_opt_in_schema', async (I) => {
180
181
  I.amOnPage('object-show-opt-in.html')
181
182
 
182
183
  // all editors visible
183
- I.waitForElement('[data-schemapath="root"]', 5)
184
- I.waitForElement('[data-schemapath="root.option_show_opt_in_undefined"]', 5)
185
- I.waitForElement('[data-schemapath="root.option_show_opt_in_undefined.string"]', 5)
186
- I.waitForElement('[data-schemapath="root.option_show_opt_in_true"]', 5)
187
- I.waitForElement('[data-schemapath="root.option_show_opt_in_true.string"]', 5)
188
- I.waitForElement('[data-schemapath="root.option_show_opt_in_false"]', 5)
189
- I.waitForElement('[data-schemapath="root.option_show_opt_in_false.string"]', 5)
184
+ I.waitForElement('[data-schemapath="root"]', DEFAULT_WAIT_TIME)
185
+ I.waitForElement('[data-schemapath="root.option_show_opt_in_undefined"]', DEFAULT_WAIT_TIME)
186
+ I.waitForElement('[data-schemapath="root.option_show_opt_in_undefined.string"]', DEFAULT_WAIT_TIME)
187
+ I.waitForElement('[data-schemapath="root.option_show_opt_in_true"]', DEFAULT_WAIT_TIME)
188
+ I.waitForElement('[data-schemapath="root.option_show_opt_in_true.string"]', DEFAULT_WAIT_TIME)
189
+ I.waitForElement('[data-schemapath="root.option_show_opt_in_false"]', DEFAULT_WAIT_TIME)
190
+ I.waitForElement('[data-schemapath="root.option_show_opt_in_false.string"]', DEFAULT_WAIT_TIME)
190
191
 
191
192
  // checkboxes for optional properties should appear only when
192
193
  // case 1) the parent option show_opt_in is enabled
@@ -198,13 +199,13 @@ Scenario('set value opt in optional properties @show_opt_in_schema', async (I) =
198
199
  // global show_opt_in true
199
200
  I.dontSeeCheckedAttribute('#show-opt-in')
200
201
  I.dontSeeElement('[data-schemapath="root.option_show_opt_in_undefined.string"] .json-editor-opt-in') // global show_opt_in: false && parent editor show_opt_in: 'undefined'
201
- I.waitForElement('[data-schemapath="root.option_show_opt_in_true.string"] .json-editor-opt-in', 5) // global show_opt_in: false && parent editor show_opt_in: true
202
+ I.waitForElement('[data-schemapath="root.option_show_opt_in_true.string"] .json-editor-opt-in', DEFAULT_WAIT_TIME) // global show_opt_in: false && parent editor show_opt_in: true
202
203
  I.dontSeeElement('[data-schemapath="root.option_show_opt_in_false.string"] .json-editor-opt-in') // global show_opt_in: false && parent editor show_opt_in: false
203
204
 
204
205
  // global show_opt_in false
205
206
  I.click('#show-opt-in')
206
207
  I.waitForElement('[data-schemapath="root.option_show_opt_in_undefined.string"] .json-editor-opt-in') // global show_opt_in: true && parent editor show_opt_in: 'undefined'
207
- I.waitForElement('[data-schemapath="root.option_show_opt_in_true.string"] .json-editor-opt-in', 5) // global show_opt_in: true && parent editor show_opt_in: true
208
+ I.waitForElement('[data-schemapath="root.option_show_opt_in_true.string"] .json-editor-opt-in', DEFAULT_WAIT_TIME) // global show_opt_in: true && parent editor show_opt_in: true
208
209
  I.dontSeeElement('[data-schemapath="root.option_show_opt_in_false.string"] .json-editor-opt-in') // global show_opt_in: true && parent editor show_opt_in: false
209
210
  })
210
211
 
@@ -245,24 +246,24 @@ Scenario('should hide properties with unfulfilled dependencies @dependencies', (
245
246
 
246
247
  Scenario('should respect multiple dependency values @dependencies', (I) => {
247
248
  I.amOnPage('object-with-dependencies-array.html')
248
- I.waitForVisible('[data-schemapath="root.question_1"] select', 5)
249
+ I.waitForVisible('[data-schemapath="root.question_1"] select', DEFAULT_WAIT_TIME)
249
250
  I.selectOption('[name="root[question_1]"]', 'a')
250
- I.waitForInvisible('[data-schemapath="root.question_1_feedback"]', 5)
251
+ I.waitForInvisible('[data-schemapath="root.question_1_feedback"]', DEFAULT_WAIT_TIME)
251
252
  I.selectOption('[name="root[question_1]"]', 'b')
252
- I.waitForVisible('[data-schemapath="root.question_1_feedback"]', 5)
253
+ I.waitForVisible('[data-schemapath="root.question_1_feedback"]', DEFAULT_WAIT_TIME)
253
254
  I.selectOption('[name="root[question_1]"]', 'c')
254
- I.waitForInvisible('[data-schemapath="root.question_1_feedback"]', 5)
255
+ I.waitForInvisible('[data-schemapath="root.question_1_feedback"]', DEFAULT_WAIT_TIME)
255
256
  I.selectOption('[name="root[question_1]"]', 'd')
256
- I.waitForVisible('[data-schemapath="root.question_1_feedback"]', 5)
257
+ I.waitForVisible('[data-schemapath="root.question_1_feedback"]', DEFAULT_WAIT_TIME)
257
258
 
258
- I.waitForVisible('[data-schemapath="root.question_2"]', 5)
259
- I.waitForInvisible('[data-schemapath="root.question_2_feedback"]', 5)
259
+ I.waitForVisible('[data-schemapath="root.question_2"]', DEFAULT_WAIT_TIME)
260
+ I.waitForInvisible('[data-schemapath="root.question_2_feedback"]', DEFAULT_WAIT_TIME)
260
261
  I.click('label[for="root[question_2]1"]')
261
262
  I.click('label[for="root[question_2]2"]')
262
- I.waitForVisible('[data-schemapath="root.question_2_feedback"]', 5)
263
+ I.waitForVisible('[data-schemapath="root.question_2_feedback"]', DEFAULT_WAIT_TIME)
263
264
  I.click('label[for="root[question_2]0"]')
264
265
  I.click('label[for="root[question_2]3"]')
265
- I.waitForInvisible('[data-schemapath="root.question_2_feedback"]', 5)
266
+ I.waitForInvisible('[data-schemapath="root.question_2_feedback"]', DEFAULT_WAIT_TIME)
266
267
  })
267
268
 
268
269
  Scenario('should open and close the properties modal', (I) => {
@@ -2,7 +2,7 @@ var assert = require('assert')
2
2
 
3
3
  Feature('option no_default_values')
4
4
 
5
- Scenario('should have correct initial value', async (I) => {
5
+ Scenario('should have correct initial value @no_default_values', async (I) => {
6
6
  I.amOnPage('option-no_default_values.html')
7
7
  I.click('.get-value')
8
8
  assert.equal(await I.grabValueFrom('.debug'), JSON.stringify({
@@ -1,19 +1,20 @@
1
1
  /* global Feature Scenario */
2
2
 
3
3
  var assert = require('assert')
4
+ const { DEFAULT_WAIT_TIME } = require('../test-config')
4
5
 
5
6
  Feature('Programmatic changes')
6
7
 
7
8
  Scenario('should have correct initial value', async (I) => {
8
9
  I.amOnPage('programmatic-changes.html')
9
- I.waitForText('READY', 5, '.state')
10
+ I.waitForText('READY', DEFAULT_WAIT_TIME, '.state')
10
11
  I.click('.get-value')
11
12
  assert.equal(await I.grabValueFrom('.value'), '{"boolean":false,"boolean_checkbox":false,"string":"","integer":0,"number":0,"array":[],"array_checkbox":[],"array_select":[]}')
12
13
  })
13
14
 
14
15
  Scenario('should have correct values after setting them programmatically', async (I) => {
15
16
  I.amOnPage('programmatic-changes.html')
16
- I.waitForText('READY', 5, '.state')
17
+ I.waitForText('READY', DEFAULT_WAIT_TIME, '.state')
17
18
  I.click('.set-values')
18
19
  I.click('.get-value')
19
20
  assert.equal(await I.grabValueFrom('.value'), '{"boolean":true,"boolean_checkbox":true,"string":"hello","integer":5,"number":5.5,"array":[1,2,3],"array_checkbox":["value1","value2"],"array_select":[1,2,3]}')
@@ -1,14 +1,16 @@
1
1
  /* global Feature Scenario */
2
2
 
3
+ const { DEFAULT_WAIT_TIME } = require('../test-config')
4
+
3
5
  Feature('Tabs')
4
6
 
5
7
  Scenario('test top-tabs', (I) => {
6
8
  I.amOnPage('tabs.html')
7
9
  I.waitForElement('[data-schemapath="root"] .json-editor-btn-add')
8
10
  I.click('[data-schemapath="root"] .json-editor-btn-add')
9
- I.waitForText('1 -', 5)
10
- I.waitForText('validation failed', 5)
11
+ I.waitForText('1 -', DEFAULT_WAIT_TIME)
12
+ I.waitForText('validation failed', DEFAULT_WAIT_TIME)
11
13
  I.fillField('root[1][name]', 'Somebody')
12
14
  I.pressKey('Tab')
13
- I.waitForText('validation passed', 5)
15
+ I.waitForText('validation passed', DEFAULT_WAIT_TIME)
14
16
  })
@@ -2,12 +2,14 @@
2
2
 
3
3
  // Note: validation.html has its own way of testing; this test simply tests if the output of that test conforms to the expected output
4
4
 
5
+ const { DEFAULT_WAIT_TIME } = require('../test-config')
6
+
5
7
  Feature('Validations')
6
8
 
7
9
  Scenario('test validations in validation.html', (I) => {
8
10
  I.amOnPage('validation.html')
9
11
  var numberOfTestItemsExpected = 158
10
- I.waitForElement('#output div:nth-child(' + numberOfTestItemsExpected + ')', 10)
12
+ I.waitForElement('#output div:nth-child(' + numberOfTestItemsExpected + ')', DEFAULT_WAIT_TIME)
11
13
  I.seeNumberOfElements('#output div', numberOfTestItemsExpected)
12
14
  I.see('success')
13
15
  I.dontSee('fail')
@@ -1,17 +1,85 @@
1
1
  /* global Feature Scenario */
2
+ const { DEFAULT_WAIT_TIME } = require('./test-config')
3
+ var assert = require('assert')
2
4
 
3
- Feature('core')
5
+ Feature('meta-schema')
6
+
7
+ Scenario('work with json-schema meta-schema @meta-schema-core', async (I) => {
8
+ I.amOnPage('meta-schema.html')
9
+ I.waitForElement('.je-ready')
10
+
11
+ I.selectOption('.je-switcher', 'Object')
12
+ assert.equal(await I.grabValueFrom('#value'), '{"properties":{},"title":"","type":"object"}')
13
+ I.click('.json-editor-btn-edit_properties')
14
+ I.waitForText('type', '.property-selector')
15
+ I.waitForText('title', '.property-selector')
16
+ I.waitForText('description', '.property-selector')
17
+ I.waitForText('enum', '.property-selector')
18
+ I.waitForText('properties', '.property-selector')
19
+ I.waitForText('definitions', '.property-selector')
20
+ I.waitForText('id', '.property-selector')
21
+ I.waitForText('$schema', '.property-selector')
22
+ I.waitForText('enumSource', '.property-selector')
23
+ I.waitForText('$ref', '.property-selector')
24
+ I.waitForText('oneOf', '.property-selector')
25
+ I.waitForText('anyOf', '.property-selector')
26
+ I.waitForText('allOf', '.property-selector')
27
+ I.waitForText('not', '.property-selector')
28
+ I.waitForText('propertyOrder', '.property-selector')
29
+ I.waitForText('links', '.property-selector')
30
+ I.waitForText('links', '.property-selector')
31
+ I.waitForText('watch', '.property-selector')
32
+ I.waitForText('headerTemplate', '.property-selector')
33
+ I.waitForText('options', '.property-selector')
34
+ I.waitForText('patternProperties', '.property-selector')
35
+ I.waitForText('additionalProperties', '.property-selector')
36
+ I.waitForText('required', '.property-selector')
37
+ I.waitForText('format', '.property-selector')
38
+
39
+ I.selectOption('.je-switcher', 'Array')
40
+ assert.equal(await I.grabValueFrom('#value'), '{"items":{"properties":{},"title":"","type":"object"},"title":"","type":"array"}')
41
+
42
+ I.selectOption('.je-switcher', 'String')
43
+ assert.equal(await I.grabValueFrom('#value'), '{"title":"","type":"string"}')
44
+
45
+ I.selectOption('.je-switcher', 'Number')
46
+ assert.equal(await I.grabValueFrom('#value'), '{"title":"","type":"number"}')
47
+
48
+ I.selectOption('.je-switcher', 'Integer')
49
+ assert.equal(await I.grabValueFrom('#value'), '{"title":"","type":"integer"}')
50
+
51
+ I.selectOption('.je-switcher', 'Boolean')
52
+ assert.equal(await I.grabValueFrom('#value'), '{"title":"","type":"boolean"}')
53
+
54
+ I.selectOption('.je-switcher', 'Null')
55
+ assert.equal(await I.grabValueFrom('#value'), '{"title":"","type":"null"}')
56
+ })
4
57
 
5
58
  // https://github.com/json-editor/json-editor/issues/823
6
- Scenario('work with json-schema meta-schema', async (I) => {
59
+ Scenario('work with json-schema meta-schema @meta-schema', async (I) => {
7
60
  I.amOnPage('issues/issue-gh-823-meta-schema.html')
8
- I.waitForElement('[data-schemapath="root"] h3', 10)
61
+ I.waitForElement('[data-schemapath="root"] h3', DEFAULT_WAIT_TIME)
9
62
  I.click('Object Properties')
10
63
  I.click('options')
11
64
  I.see('$ref')
12
65
  I.see('options')
13
- // pause();
14
66
  I.click('Object Properties')
15
67
  I.click('Object Properties')
16
68
  I.see('options')
69
+ I.dontSee('Value must validate against exactly one of the provided schemas. It currently validates against 0 of the schemas.')
70
+ I.dontSee('No additional properties allowed, but property title is set')
71
+ })
72
+
73
+ // https://github.com/json-editor/json-editor/issues/1233
74
+ Scenario('passing meta-schema example @meta-schema', async (I) => {
75
+ I.amOnPage('issues/issue-gh-1233-passing.html')
76
+ I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
77
+ I.waitForElement('[name="root[name]"]', DEFAULT_WAIT_TIME)
78
+ })
79
+
80
+ // https://github.com/json-editor/json-editor/issues/1233
81
+ Scenario('failing meta-schema example @meta-schema @optional', async (I) => {
82
+ I.amOnPage('issues/issue-gh-1233-failing.html')
83
+ I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
84
+ I.waitForElement('[name="root[name]"]', DEFAULT_WAIT_TIME)
17
85
  })