@json-editor/json-editor 2.9.1 → 2.10.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.
- package/CHANGELOG.md +18 -0
- package/README.md +47 -1
- package/dist/jsoneditor.js +1 -1
- package/dist/jsoneditor.js.LICENSE.txt +1 -1
- package/dist/nonmin/jsoneditor.js +445 -124
- package/dist/nonmin/jsoneditor.js.map +1 -1
- package/docs/css_integration.html +17 -15
- package/docs/custom-editor.html +92 -0
- package/docs/index.html +4 -1
- package/docs/meta_schema.json +426 -398
- package/package.json +1 -1
- package/src/defaults.js +15 -1
- package/src/editor.js +23 -6
- package/src/editors/multiple.js +64 -7
- package/src/editors/object.js +0 -1
- package/src/iconlibs/bootstrap.js +28 -0
- package/src/iconlibs/index.js +2 -0
- package/src/resolvers.js +5 -2
- package/src/schemaloader.js +3 -1
- package/src/themes/bootstrap3.js +1 -1
- package/src/utilities.js +22 -0
- package/src/validator.js +93 -0
- package/tests/codeceptjs/constrains/contains_test.js +36 -0
- package/tests/codeceptjs/constrains/dependentSchemas_test.js +15 -0
- package/tests/codeceptjs/constrains/if-then-else_test.js +143 -0
- package/tests/codeceptjs/core_test.js +27 -27
- package/tests/codeceptjs/editors/advanced_test.js +11 -10
- package/tests/codeceptjs/editors/array_any_of_test.js +35 -35
- package/tests/codeceptjs/editors/array_test.js +757 -767
- package/tests/codeceptjs/editors/autocomplete_test.js +1 -3
- package/tests/codeceptjs/editors/button_test.js +25 -24
- package/tests/codeceptjs/editors/checkbox_test.js +17 -16
- package/tests/codeceptjs/editors/colorpicker_test.js +18 -16
- package/tests/codeceptjs/editors/datetime_test.js +7 -7
- package/tests/codeceptjs/editors/inheritance_test.js +7 -8
- package/tests/codeceptjs/editors/integer_test.js +71 -72
- package/tests/codeceptjs/editors/jodit_test.js +16 -17
- package/tests/codeceptjs/editors/multiselect_test.js +5 -5
- package/tests/codeceptjs/editors/number_test.js +64 -65
- package/tests/codeceptjs/editors/object_test.js +39 -13
- package/tests/codeceptjs/editors/option-no_default_values_test.js +4 -4
- package/tests/codeceptjs/editors/programmatic-changes_test.js +2 -3
- package/tests/codeceptjs/editors/range_test.js +1 -3
- package/tests/codeceptjs/editors/select_test.js +3 -5
- package/tests/codeceptjs/editors/stepper_test.js +5 -7
- package/tests/codeceptjs/editors/string_test.js +8 -8
- package/tests/codeceptjs/editors/table-confirm-delete_test.js +7 -9
- package/tests/codeceptjs/editors/uuid_test.js +10 -10
- package/tests/codeceptjs/editors/validation_test.js +1 -1
- package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1133_test.js +1 -3
- package/tests/codeceptjs/issues/issue-gh-1158-2_test.js +10 -0
- package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1158_test.js +0 -2
- package/tests/codeceptjs/issues/issue-gh-1164_test.js +10 -0
- package/tests/codeceptjs/issues/issue-gh-1211_test.js +17 -0
- package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1257_test.js +2 -4
- package/tests/codeceptjs/issues/issue-gh-1338_test.js +16 -0
- package/tests/codeceptjs/issues/issue-gh-1347_test.js +8 -0
- package/tests/codeceptjs/issues/issue-gh-795_test.js +13 -0
- package/tests/codeceptjs/issues/issue-gh-810_test.js +52 -0
- package/tests/codeceptjs/issues/issue-gh-812_test.js +25 -0
- package/tests/codeceptjs/meta-schema_test.js +10 -10
- package/tests/codeceptjs/schemaloader_test.js +7 -7
- package/tests/codeceptjs/themes_test.js +31 -0
- package/tests/pages/autocomplete.html +1 -0
- package/tests/pages/contains.html +38 -0
- package/tests/pages/dependentSchemas.html +52 -0
- package/tests/pages/if-else.html +57 -0
- package/tests/pages/if-then-else-allOf.html +117 -0
- package/tests/pages/if-then-else.html +64 -0
- package/tests/pages/if-then.html +57 -0
- package/tests/pages/issues/issue-gh-1158-2.html +189 -0
- package/tests/pages/issues/issue-gh-1165.html +63 -0
- package/tests/pages/issues/issue-gh-1165.json +8 -0
- package/tests/pages/issues/issue-gh-1211.html +1022 -0
- package/tests/pages/issues/issue-gh-1338.html +74 -0
- package/tests/pages/issues/issue-gh-1347.html +142 -0
- package/tests/pages/issues/issue-gh-795.html +58 -0
- package/tests/pages/issues/issue-gh-810.html +149 -0
- package/tests/pages/maxContains.html +39 -0
- package/tests/pages/meta-schema.html +28 -0
- package/tests/pages/meta_schema.json +426 -398
- package/tests/pages/minContains.html +39 -0
- package/tests/pages/option-dependencies.html +106 -0
- package/tests/pages/themes.html +3 -1
- package/tests/unit/core.spec.js +2 -5
- package/tests/codeceptjs/editors/issues/issue-gh-1164_test.js +0 -12
- package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +0 -32
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* global Feature Scenario */
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
68
|
+
I.waitForValue('.value', '{"age":18,"name":"Francesco Avizzano"}')
|
|
69
69
|
I.click('.set-value')
|
|
70
70
|
I.click('.get-value')
|
|
71
|
-
|
|
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
|
-
|
|
77
|
+
I.waitForValue('.value', '"Francesco Avizzano"')
|
|
78
78
|
I.click('.set-individual-value')
|
|
79
|
-
|
|
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
|
-
|
|
119
|
+
I.waitForValue('#value-form-1', '"yes"')
|
|
120
120
|
I.click('#get-value-form-2')
|
|
121
|
-
|
|
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 }) => {
|
|
@@ -182,69 +182,69 @@ Scenario('Should switch between all json 7 data types in @oneof and display erro
|
|
|
182
182
|
I.waitForElement('.je-ready')
|
|
183
183
|
|
|
184
184
|
I.selectOption('.je-switcher', 'Value, string')
|
|
185
|
-
|
|
185
|
+
I.waitForValue('#value', '{"test":""}')
|
|
186
186
|
I.waitForText('Value must validate against exactly one of the provided schemas.')
|
|
187
187
|
I.waitForText('Value must be the constant value')
|
|
188
188
|
|
|
189
189
|
I.selectOption('.je-switcher', 'Value, boolean')
|
|
190
|
-
|
|
190
|
+
I.waitForValue('#value', '{"test":false}')
|
|
191
191
|
I.waitForText('Value must validate against exactly one of the provided schemas.')
|
|
192
192
|
I.waitForText('Value must be the constant value')
|
|
193
193
|
|
|
194
194
|
I.selectOption('.je-switcher', 'Value, array')
|
|
195
|
-
|
|
195
|
+
I.waitForValue('#value', '{"test":[]}')
|
|
196
196
|
I.waitForText('Value must validate against exactly one of the provided schemas.')
|
|
197
197
|
I.waitForText('Value must be the constant value')
|
|
198
198
|
|
|
199
199
|
I.selectOption('.je-switcher', 'Value, object')
|
|
200
|
-
|
|
200
|
+
I.waitForValue('#value', '{"test":{}}')
|
|
201
201
|
I.waitForText('Value must validate against exactly one of the provided schemas.')
|
|
202
202
|
I.waitForText('Value must be the constant value')
|
|
203
203
|
I.waitForText('Object is missing the required property \'test\'')
|
|
204
204
|
|
|
205
205
|
I.selectOption('.je-switcher', 'Value, number')
|
|
206
|
-
|
|
206
|
+
I.waitForValue('#value', '{"test":0}')
|
|
207
207
|
I.waitForText('Value must validate against exactly one of the provided schemas.')
|
|
208
208
|
I.waitForText('Value must be the constant value')
|
|
209
209
|
|
|
210
210
|
I.selectOption('.je-switcher', 'Value, integer')
|
|
211
|
-
|
|
211
|
+
I.waitForValue('#value', '{"test":0}')
|
|
212
212
|
I.waitForText('Value must validate against exactly one of the provided schemas.')
|
|
213
213
|
I.waitForText('Value must be the constant value')
|
|
214
214
|
|
|
215
215
|
I.selectOption('.je-switcher', 'Value, null')
|
|
216
|
-
|
|
216
|
+
I.waitForValue('#value', '{"test":null}')
|
|
217
217
|
})
|
|
218
218
|
|
|
219
|
-
Scenario('Should switch between all json 7 data types in @anyof and display error messages for each one @core',
|
|
219
|
+
Scenario('Should switch between all json 7 data types in @anyof and display error messages for each one @core', ({ I }) => {
|
|
220
220
|
I.amOnPage('anyof-2.html')
|
|
221
221
|
I.waitForElement('.je-ready')
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
I.waitForValue('#value', '{"test":""}')
|
|
224
224
|
I.waitForText('Value must validate against at least one of the provided schemas')
|
|
225
225
|
|
|
226
226
|
I.selectOption('.je-switcher', 'Value, boolean')
|
|
227
|
-
|
|
227
|
+
I.waitForValue('#value', '{"test":false}')
|
|
228
228
|
I.waitForText('Value must validate against at least one of the provided schemas')
|
|
229
229
|
|
|
230
230
|
I.selectOption('.je-switcher', 'Value, array')
|
|
231
|
-
|
|
231
|
+
I.waitForValue('#value', '{"test":[]}')
|
|
232
232
|
I.waitForText('Value must validate against at least one of the provided schemas')
|
|
233
233
|
|
|
234
234
|
I.selectOption('.je-switcher', 'Value, object')
|
|
235
|
-
|
|
235
|
+
I.waitForValue('#value', '{"test":{}}')
|
|
236
236
|
I.waitForText('Value must validate against at least one of the provided schemas')
|
|
237
237
|
|
|
238
238
|
I.selectOption('.je-switcher', 'Value, number')
|
|
239
|
-
|
|
239
|
+
I.waitForValue('#value', '{"test":0}')
|
|
240
240
|
I.waitForText('Value must validate against at least one of the provided schemas')
|
|
241
241
|
|
|
242
242
|
I.selectOption('.je-switcher', 'Value, integer')
|
|
243
|
-
|
|
243
|
+
I.waitForValue('#value', '{"test":0}')
|
|
244
244
|
I.waitForText('Value must validate against at least one of the provided schemas')
|
|
245
245
|
|
|
246
246
|
I.selectOption('.je-switcher', 'Value, null')
|
|
247
|
-
|
|
247
|
+
I.waitForValue('#value', '{"test":null}')
|
|
248
248
|
})
|
|
249
249
|
|
|
250
250
|
Scenario('should validate against oneOf schemas and display single oneOf and editors error messages @core @translate-property', async ({ I }) => {
|
|
@@ -346,17 +346,17 @@ Scenario('should load internal schema definitions, external schema definitions a
|
|
|
346
346
|
'../fixtures/string.json',
|
|
347
347
|
'../fixtures/definitions.json',
|
|
348
348
|
'../fixtures/basic_person.json',
|
|
349
|
-
'../fixtures/person.json'
|
|
349
|
+
'../fixtures/person.json'
|
|
350
350
|
]
|
|
351
351
|
for (const path of schemaPaths) {
|
|
352
|
-
|
|
352
|
+
const key = 'je-cache::' + currentPath + path
|
|
353
353
|
|
|
354
354
|
const item = await I.executeScript(function (storageKey) {
|
|
355
|
-
return window.localStorage.getItem(storageKey)
|
|
355
|
+
return window.localStorage.getItem(storageKey)
|
|
356
356
|
}, key)
|
|
357
357
|
const itemDecoded = JSON.parse(item)
|
|
358
|
-
assert.
|
|
359
|
-
assert(itemDecoded, 'Cached schema found')
|
|
358
|
+
assert.strictEqual(itemDecoded.cacheBuster, 'abc123')
|
|
359
|
+
assert(itemDecoded, 'Cached schema found')
|
|
360
360
|
}
|
|
361
361
|
})
|
|
362
362
|
|
|
@@ -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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
1
|
+
/* global Feature Scenario */
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
25
|
-
assert.
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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
|
+
})
|