@json-editor/json-editor 2.9.0 → 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.
Files changed (106) hide show
  1. package/.github/workflows/build.yml +2 -0
  2. package/CHANGELOG.md +29 -7
  3. package/README.md +47 -1
  4. package/config/codeceptjs_helpers.js +4 -8
  5. package/config/karma.conf.js +0 -4
  6. package/config/webpack.common.js +1 -1
  7. package/config/webpack.dev.js +1 -1
  8. package/config/webpack.nonmin.js +1 -1
  9. package/config/webpack.prod.js +0 -1
  10. package/dist/dev/jsoneditor.js +3687 -0
  11. package/dist/jsoneditor.js +2 -14
  12. package/dist/jsoneditor.js.LICENSE.txt +1 -1
  13. package/dist/jsoneditor.js.map +1 -1
  14. package/dist/nonmin/jsoneditor.js +25744 -26450
  15. package/dist/nonmin/jsoneditor.js.map +1 -1
  16. package/docs/css_integration.html +17 -15
  17. package/docs/custom-editor.html +92 -0
  18. package/docs/datetime.html +37 -2
  19. package/docs/index.html +4 -1
  20. package/docs/meta_schema.json +426 -398
  21. package/package.json +26 -24
  22. package/src/defaults.js +15 -1
  23. package/src/editor.js +23 -6
  24. package/src/editors/integer.js +5 -3
  25. package/src/editors/multiple.js +67 -8
  26. package/src/editors/number.js +5 -3
  27. package/src/editors/object.js +0 -1
  28. package/src/editors/radio.js +4 -6
  29. package/src/editors/select.js +0 -6
  30. package/src/iconlibs/bootstrap.js +28 -0
  31. package/src/iconlibs/index.js +2 -0
  32. package/src/resolvers.js +5 -2
  33. package/src/schemaloader.js +3 -1
  34. package/src/themes/bootstrap3.js +1 -1
  35. package/src/utilities.js +22 -0
  36. package/src/validator.js +93 -0
  37. package/tests/codeceptjs/constrains/contains_test.js +36 -0
  38. package/tests/codeceptjs/constrains/dependentSchemas_test.js +15 -0
  39. package/tests/codeceptjs/constrains/if-then-else_test.js +143 -0
  40. package/tests/codeceptjs/core_test.js +46 -46
  41. package/tests/codeceptjs/editors/advanced_test.js +12 -11
  42. package/tests/codeceptjs/editors/array_any_of_test.js +37 -37
  43. package/tests/codeceptjs/editors/array_test.js +784 -794
  44. package/tests/codeceptjs/editors/autocomplete_test.js +4 -6
  45. package/tests/codeceptjs/editors/button_test.js +30 -29
  46. package/tests/codeceptjs/editors/checkbox_test.js +19 -18
  47. package/tests/codeceptjs/editors/colorpicker_test.js +20 -18
  48. package/tests/codeceptjs/editors/datetime_test.js +11 -11
  49. package/tests/codeceptjs/editors/inheritance_test.js +8 -9
  50. package/tests/codeceptjs/editors/integer_test.js +77 -78
  51. package/tests/codeceptjs/editors/jodit_test.js +18 -19
  52. package/tests/codeceptjs/editors/multiselect_test.js +6 -6
  53. package/tests/codeceptjs/editors/number_test.js +72 -71
  54. package/tests/codeceptjs/editors/object_test.js +52 -26
  55. package/tests/codeceptjs/editors/option-no_default_values_test.js +6 -6
  56. package/tests/codeceptjs/editors/programmatic-changes_test.js +4 -5
  57. package/tests/codeceptjs/editors/radio_test.js +1 -1
  58. package/tests/codeceptjs/editors/range_test.js +2 -4
  59. package/tests/codeceptjs/editors/rating_test.js +1 -1
  60. package/tests/codeceptjs/editors/select_test.js +5 -7
  61. package/tests/codeceptjs/editors/stepper_test.js +8 -10
  62. package/tests/codeceptjs/editors/string_test.js +16 -16
  63. package/tests/codeceptjs/editors/table-confirm-delete_test.js +11 -13
  64. package/tests/codeceptjs/editors/tabs_test.js +1 -1
  65. package/tests/codeceptjs/editors/uuid_test.js +15 -15
  66. package/tests/codeceptjs/editors/validation_test.js +2 -2
  67. package/tests/codeceptjs/issues/issue-gh-1133_test.js +9 -0
  68. package/tests/codeceptjs/issues/issue-gh-1158-2_test.js +10 -0
  69. package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1158_test.js +1 -3
  70. package/tests/codeceptjs/issues/issue-gh-1164_test.js +10 -0
  71. package/tests/codeceptjs/issues/issue-gh-1211_test.js +17 -0
  72. package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1257_test.js +3 -5
  73. package/tests/codeceptjs/issues/issue-gh-1338_test.js +16 -0
  74. package/tests/codeceptjs/issues/issue-gh-1347_test.js +8 -0
  75. package/tests/codeceptjs/issues/issue-gh-795_test.js +13 -0
  76. package/tests/codeceptjs/issues/issue-gh-810_test.js +52 -0
  77. package/tests/codeceptjs/issues/issue-gh-812_test.js +25 -0
  78. package/tests/codeceptjs/meta-schema_test.js +12 -12
  79. package/tests/codeceptjs/schemaloader_test.js +8 -8
  80. package/tests/codeceptjs/themes_test.js +40 -9
  81. package/tests/pages/autocomplete.html +1 -0
  82. package/tests/pages/contains.html +38 -0
  83. package/tests/pages/dependentSchemas.html +52 -0
  84. package/tests/pages/if-else.html +57 -0
  85. package/tests/pages/if-then-else-allOf.html +117 -0
  86. package/tests/pages/if-then-else.html +64 -0
  87. package/tests/pages/if-then.html +57 -0
  88. package/tests/pages/issues/issue-gh-1133.html +64 -0
  89. package/tests/pages/issues/issue-gh-1158-2.html +189 -0
  90. package/tests/pages/issues/issue-gh-1164.html +71 -0
  91. package/tests/pages/issues/issue-gh-1165.html +63 -0
  92. package/tests/pages/issues/issue-gh-1165.json +8 -0
  93. package/tests/pages/issues/issue-gh-1211.html +1022 -0
  94. package/tests/pages/issues/issue-gh-1338.html +74 -0
  95. package/tests/pages/issues/issue-gh-1347.html +142 -0
  96. package/tests/pages/issues/issue-gh-795.html +58 -0
  97. package/tests/pages/issues/issue-gh-810.html +149 -0
  98. package/tests/pages/maxContains.html +39 -0
  99. package/tests/pages/meta-schema.html +28 -0
  100. package/tests/pages/meta_schema.json +426 -398
  101. package/tests/pages/minContains.html +39 -0
  102. package/tests/pages/number.html +18 -0
  103. package/tests/pages/option-dependencies.html +106 -0
  104. package/tests/pages/themes.html +3 -1
  105. package/tests/unit/core.spec.js +8 -10
  106. package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +0 -32
@@ -0,0 +1,143 @@
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.fillField('[name="root[postal_code]"]', 'K1M 1M4')
72
+ I.pressKey('Tab')
73
+ I.waitForElement('.invalid-feedback')
74
+ I.waitForText('Value must match the pattern [0-9]{5}(-[0-9]{4})?.')
75
+
76
+ I.selectOption('[name="root[country]"]', 'Canada')
77
+ I.fillField('[name="root[postal_code]"]', '10000')
78
+ I.pressKey('Tab')
79
+ I.waitForElement('.invalid-feedback')
80
+ I.waitForText('Value must match the pattern [A-Z][0-9][A-Z] [0-9][A-Z][0-9].')
81
+
82
+ I.selectOption('[name="root[country]"]', 'America')
83
+ I.fillField('[name="root[postal_code]"]', '10000')
84
+ I.pressKey('Tab')
85
+ I.dontSee('.invalid-feedback')
86
+
87
+ I.selectOption('[name="root[country]"]', 'Canada')
88
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
89
+ I.pressKey('Tab')
90
+ I.dontSee('.invalid-feedback')
91
+ })
92
+
93
+ Scenario('validate agaist if-then @if-then-else', async ({ I }) => {
94
+ I.amOnPage('if-then.html')
95
+ I.waitForElement('.je-ready')
96
+
97
+ I.selectOption('[name="root[country]"]', 'America')
98
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
99
+ I.pressKey('Tab')
100
+ I.waitForElement('.invalid-feedback')
101
+ I.waitForText('Value must match the pattern [0-9]{5}(-[0-9]{4})?.')
102
+
103
+ I.selectOption('[name="root[country]"]', 'Canada')
104
+ I.fillField('[name="root[postal_code]"]', '10000')
105
+ I.pressKey('Tab')
106
+ I.dontSee('.invalid-feedback')
107
+
108
+ I.selectOption('[name="root[country]"]', 'America')
109
+ I.fillField('[name="root[postal_code]"]', '10000')
110
+ I.pressKey('Tab')
111
+ I.dontSee('.invalid-feedback')
112
+
113
+ I.selectOption('[name="root[country]"]', 'Canada')
114
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
115
+ I.pressKey('Tab')
116
+ I.dontSee('.invalid-feedback')
117
+ })
118
+
119
+ Scenario('validate agaist if-else @if-then-else', async ({ I }) => {
120
+ I.amOnPage('if-else.html')
121
+ I.waitForElement('.je-ready')
122
+
123
+ I.selectOption('[name="root[country]"]', 'America')
124
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
125
+ I.pressKey('Tab')
126
+ I.dontSee('.invalid-feedback')
127
+
128
+ I.selectOption('[name="root[country]"]', 'Canada')
129
+ I.fillField('[name="root[postal_code]"]', '10000')
130
+ I.pressKey('Tab')
131
+ I.waitForElement('.invalid-feedback')
132
+ I.waitForText('Value must match the pattern [A-Z][0-9][A-Z] [0-9][A-Z][0-9].')
133
+
134
+ I.selectOption('[name="root[country]"]', 'America')
135
+ I.fillField('[name="root[postal_code]"]', '10000')
136
+ I.pressKey('Tab')
137
+ I.dontSee('.invalid-feedback')
138
+
139
+ I.selectOption('[name="root[country]"]', 'Canada')
140
+ I.fillField('[name="root[postal_code]"]', 'K1M 1M4')
141
+ I.pressKey('Tab')
142
+ I.dontSee('.invalid-feedback')
143
+ })
@@ -1,11 +1,11 @@
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')
7
7
 
8
- Scenario('should set per-editor options @per-editor-options', async (I) => {
8
+ Scenario('should set per-editor options @per-editor-options', async ({ I }) => {
9
9
  I.amOnPage('per-editor-options.html')
10
10
  I.waitForElement('.je-ready')
11
11
  I.waitForElement('[title="Expand"]')
@@ -13,7 +13,7 @@ Scenario('should set per-editor options @per-editor-options', async (I) => {
13
13
  I.dontSeeElement('.card')
14
14
  })
15
15
 
16
- Scenario('should set container attributes @container-attributes', async (I) => {
16
+ Scenario('should set container attributes @container-attributes', async ({ I }) => {
17
17
  I.amOnPage('container-attributes.html')
18
18
  I.waitForElement('.je-ready')
19
19
  I.waitForElement('.container-class')
@@ -22,18 +22,18 @@ Scenario('should set container attributes @container-attributes', async (I) => {
22
22
  I.dontSeeElement('[data-schemaid="blank"]')
23
23
  })
24
24
 
25
- Scenario('should not set inputs name attributes @use-name-attributes', async (I) => {
25
+ Scenario('should not set inputs name attributes @use-name-attributes', async ({ I }) => {
26
26
  I.amOnPage('use-name-attributes.html')
27
27
  I.waitForElement('.je-ready')
28
28
  I.dontSeeElement('[name]')
29
29
  })
30
30
 
31
- Scenario('should have class je-ready when ready @core @ready', async (I) => {
31
+ Scenario('should have class je-ready when ready @core @ready', async ({ I }) => {
32
32
  I.amOnPage('ready.html')
33
33
  I.waitForElement('.je-ready')
34
34
  })
35
35
 
36
- Scenario('should Disable and enable entire form', async (I) => {
36
+ Scenario('should Disable and enable entire form', async ({ I }) => {
37
37
  I.amOnPage('core.html')
38
38
  I.seeElement('[data-schemapath="root.name"] input')
39
39
  I.seeElement('[data-schemapath="root.age"] input')
@@ -45,7 +45,7 @@ Scenario('should Disable and enable entire form', async (I) => {
45
45
  I.seeElement('[data-schemapath="root.name"] input:not(:disabled)')
46
46
  })
47
47
 
48
- Scenario('should Disable and enable part of the form', async (I) => {
48
+ Scenario('should Disable and enable part of the form', async ({ I }) => {
49
49
  I.amOnPage('core.html')
50
50
  I.seeElement('[data-schemapath="root.name"] input')
51
51
  I.seeElement('[data-schemapath="root.age"] input')
@@ -55,45 +55,45 @@ Scenario('should Disable and enable part of the form', async (I) => {
55
55
  I.seeElement('[data-schemapath="root.name"] input:not(:disabled)')
56
56
  })
57
57
 
58
- Scenario('should destroy', async (I) => {
58
+ Scenario('should destroy', async ({ I }) => {
59
59
  I.amOnPage('core.html')
60
60
  I.seeElement('[data-schemapath="root"]')
61
61
  I.click('destroy')
62
62
  I.dontSeeElement('[data-schemapath="root"]')
63
63
  })
64
64
 
65
- Scenario('should set and get form value', async (I) => {
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
- Scenario('should set and get individual values', async (I) => {
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
- Scenario('should watch a specific field for changes', async (I) => {
82
+ Scenario('should watch a specific field for changes', async ({ I }) => {
83
83
  I.amOnPage('core.html')
84
84
  I.dontSeeElement('.name-changed')
85
85
  I.click('.set-individual-value')
86
86
  I.seeElement('.name-changed')
87
87
  })
88
88
 
89
- Scenario('should watch form for changes', async (I) => {
89
+ Scenario('should watch form for changes', async ({ I }) => {
90
90
  I.amOnPage('core.html')
91
91
  I.dontSeeElement('.form-changed')
92
92
  I.click('.set-value')
93
93
  I.seeElement('.form-changed')
94
94
  })
95
95
 
96
- Scenario('should change the form if form_name_root option is set @core', async (I) => {
96
+ Scenario('should change the form if form_name_root option is set @core', async ({ I }) => {
97
97
  I.amOnPage('form-name.html')
98
98
  I.see('Property must be set.', '.invalid-feedback')
99
99
  I.seeElement('[data-schemapath="form_1"]')
@@ -116,12 +116,12 @@ 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
- Scenario('should validate against oneOf schemas and display single oneOf and editors error messages @core @oneof', async (I) => {
124
+ Scenario('should validate against oneOf schemas and display single oneOf and editors error messages @core @oneof', async ({ I }) => {
125
125
  I.amOnPage('oneof.html')
126
126
  I.waitForElement('.je-ready')
127
127
  I.waitForText('Object is missing the required property \'p4\'', DEFAULT_WAIT_TIME, '.alert-danger')
@@ -152,7 +152,7 @@ Scenario('should validate against oneOf schemas and display single oneOf and edi
152
152
  I.dontSee('Value must be at least 4 characters long.', '[data-schemapath="root.p5.p2"] .invalid-feedback')
153
153
  })
154
154
 
155
- Scenario('should validate against anyOf schemas and display single anyOf and editors error messages @core @anyof', async (I) => {
155
+ Scenario('should validate against anyOf schemas and display single anyOf and editors error messages @core @anyof', async ({ I }) => {
156
156
  I.amOnPage('anyof.html')
157
157
  I.waitForElement('.je-ready')
158
158
  I.waitForElement('.alert-danger')
@@ -170,84 +170,84 @@ 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 display anyOf and oneOf error messages in the correct places @848', async (I) => {
173
+ Scenario('should display anyOf and oneOf error messages in the correct places @848', async ({ I }) => {
174
174
  I.amOnPage('issues/issue-gh-848.html')
175
175
  I.selectOption('.je-switcher', 'Value, string')
176
176
  I.waitForElement('[data-schemapath="root.list"] .invalid-feedback', DEFAULT_WAIT_TIME)
177
177
  I.dontSeeElement('[data-schemapath="root.list_group"] .invalid-feedback', DEFAULT_WAIT_TIME)
178
178
  })
179
179
 
180
- Scenario('Should switch between all json 7 data types in @oneof and display error messages for each one @core', async (I) => {
180
+ Scenario('Should switch between all json 7 data types in @oneof and display error messages for each one @core', async ({ I }) => {
181
181
  I.amOnPage('oneof-2.html')
182
182
  I.waitForElement('.je-ready')
183
183
 
184
184
  I.selectOption('.je-switcher', 'Value, string')
185
- assert.equal(await I.grabValueFrom('#value'), '{"test":""}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":false}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":[]}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":{}}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":null}')
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', async (I) => {
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":""}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":false}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":[]}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":{}}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":0}')
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
- assert.equal(await I.grabValueFrom('#value'), '{"test":null}')
247
+ I.waitForValue('#value', '{"test":null}')
248
248
  })
249
249
 
250
- Scenario('should validate against oneOf schemas and display single oneOf and editors error messages @core @translate-property', async (I) => {
250
+ Scenario('should validate against oneOf schemas and display single oneOf and editors error messages @core @translate-property', async ({ I }) => {
251
251
  I.amOnPage('translate-property.html?lang=en')
252
252
  I.waitForText('Object Title')
253
253
  I.waitForText('Object Description')
@@ -317,7 +317,7 @@ Scenario('should validate against oneOf schemas and display single oneOf and edi
317
317
  I.seeInSource('Rating Info Text (but in german)')
318
318
  })
319
319
 
320
- Scenario('should load internal schema definitions, external schema definitions and external schema properties @core @references', async (I) => {
320
+ Scenario('should load internal schema definitions, external schema definitions and external schema properties @core @references', async ({ I }) => {
321
321
  I.amOnPage('references.html')
322
322
  I.waitForText('References JSON Editor Example')
323
323
 
@@ -346,21 +346,21 @@ 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
- let key = 'je-cache::' + currentPath + path;
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.equal(itemDecoded.cacheBuster, 'abc123');
359
- assert(itemDecoded, 'Cached schema found');
358
+ assert.strictEqual(itemDecoded.cacheBuster, 'abc123')
359
+ assert(itemDecoded, 'Cached schema found')
360
360
  }
361
361
  })
362
362
 
363
- Scenario('should override error messages if specified in schema options @core @errors-messages', async (I) => {
363
+ Scenario('should override error messages if specified in schema options @core @errors-messages', async ({ I }) => {
364
364
  I.amOnPage('error-messages.html')
365
365
  I.waitForText('Error Messages')
366
366
 
@@ -1,13 +1,14 @@
1
+ /* global Feature Scenario */
1
2
 
2
- Feature('Advanced Editor');
3
+ Feature('Advanced Editor')
3
4
 
4
- 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
- });
5
+ Scenario('test validation & delete', ({ I }) => {
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
4
5
 
5
- 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
- });
6
+ Feature('anyof in array')
10
7
 
11
- 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"]');
8
+ Scenario('should have correct initial value', async ({ I }) => {
9
+ I.amOnPage('array-anyof.html')
10
+ I.click('.get-value')
11
+ I.waitForValue('.debug', '{"correct":"","items":[]}')
12
+ })
15
13
 
16
- I.click('.get-value');
17
- value = await I.grabValueFrom('.debug');
18
- assert.equal(value, '{"correct":"","items":[]}');
14
+ Scenario('should show errors @optional', async ({ I }) => {
15
+ I.amOnPage('array-anyof.html')
16
+ I.seeElement('[data-schemapath="root"]')
17
+ I.seeElement('[data-schemapath="root.items"]')
19
18
 
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');
19
+ I.click('.get-value')
20
+ I.waitForValue('.debug', '{"correct":"","items":[]}')
22
21
 
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');
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')
26
24
 
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");
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')
30
28
 
31
- I.fillField('root[correct]', 'a');
32
- I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.');
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')
33
32
 
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":""}]}');
33
+ I.fillField('root[correct]', 'a')
34
+ I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.')
38
35
 
39
- I.fillField('root[items][0][id]', 'a');
40
- I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.');
36
+ I.click('.json-editor-btntype-add')
37
+ I.click('.get-value')
38
+ I.waitForValue('.debug', '{"correct":"a","items":[{"handler":"aaa","id":"","___a":""}]}')
41
39
 
42
- I.clearField('root[items][0][id]');
43
- I.seeInField('root[items][0][id]', '');
44
- // todo still not work
45
- assert.equal(await I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.'), true, 'should show warning');
40
+ I.fillField('root[items][0][id]', 'a')
41
+ I.dontSee('Value must match the pattern ^[a-zA-Z0-9_]+$.')
46
42
 
47
- I.fillField('root[items][0][id]', 'a!');
48
- I.see('Value must match the pattern ^[a-zA-Z0-9_]+$.');
43
+ I.clearField('root[items][0][id]')
44
+ I.seeInField('root[items][0][id]', '')
45
+ // todo still not work
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
+ })