Skip to content

Commit f53c62a

Browse files
committed
Testest enforce_const in combination with setValue()
1 parent e63ba65 commit f53c62a

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

tests/pages/enforce-const.html

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,16 @@
2525
"title": "string (StringEditor)",
2626
"type": "string",
2727
"const": "Alice",
28-
// "options": { "enforce_const": false }
2928
},
3029
"integer": {
3130
"title": "integer (IntegerEditor)",
3231
"type": "integer",
3332
"const": 5,
34-
// "options": { "enforce_const": false }
3533
},
3634
"number": {
3735
"title": "number (NumberEditor)",
3836
"type": "number",
3937
"const": 5.5,
40-
// "options": { "enforce_const": false }
4138
},
4239
"string-enum": {
4340
"title": "string-enum (SelectEditor)",
@@ -48,44 +45,38 @@
4845
"Bob",
4946
"Carl"
5047
],
51-
// "options": { "enforce_const": false }
5248
},
5349
"boolean": {
5450
"title": "boolean (SelectEditor)",
5551
"type": "boolean",
5652
"const": true,
57-
// "options": { "enforce_const": false }
5853
},
5954
"boolean-checkbox": {
6055
"title": "boolean-checkbox (CheckboxEditor)",
6156
"type": "boolean",
6257
"format": "checkbox",
6358
"const": true,
64-
// "options": { "enforce_const": false }
6559
},
6660
"boolean-choices": {
6761
"title": "boolean-choices (ChoicesEditor)",
6862
"type": "boolean",
6963
"format": "choices",
7064
"const": true,
71-
// "options": { "enforce_const": false }
7265
},
7366
"object": {
7467
"title": "object (ObjectEditor)",
7568
"type": "object",
7669
"const": {"name": "Alice"},
77-
// "options": { "enforce_const": false },
7870
"properties": {
7971
"name": {
8072
"type": "string"
8173
}
8274
}
8375
},
8476
"array": {
85-
"title": "array (TableEditor)",
77+
"title": "array",
8678
"type": "array",
8779
"const": [{"name": "Alice"}, {"name": "Bob"}],
88-
// "options": { "enforce_const": false },
8980
"items": {
9081
"title": "object",
9182
"type": "object",
@@ -104,31 +95,27 @@
10495
"items": {
10596
"title": "object",
10697
"type": "object",
107-
"const": {"name": "Alice"},
10898
"properties": {
10999
"name": {
110100
"type": "string"
111101
}
112102
}
113103
},
114-
// "options": { "enforce_const": false }
115104
},
116105
"array-tabs": {
117-
"title": "array (TableEditor)",
106+
"title": "array (TabsEditor)",
118107
"type": "array",
119108
"format": "tabs",
120109
"const": [{"name": "Alice"}, {"name": "Bob"}],
121110
"items": {
122111
"title": "object",
123112
"type": "object",
124-
"const": {"name": "Alice"},
125113
"properties": {
126114
"name": {
127115
"type": "string"
128116
}
129117
}
130118
},
131-
// "options": { "enforce_const": false }
132119
},
133120
"array-of-strings": {
134121
"title": "array (MultiselectEditor)",
@@ -140,21 +127,18 @@
140127
"enum": ["Alice", "Bob"]
141128
},
142129
"const": ["Alice", "Bob"],
143-
// "options": { "enforce_const": false }
144130
},
145131
"array-enum": {
146132
"title": "array (EnumEditor)",
147133
"type": "array",
148134
"enum": [["Alice", "Bob"], ["Carl", "Dennis"]],
149135
"const": ["Carl", "Dennis"],
150-
// "options": { "enforce_const": false }
151136
},
152137
"object-enum": {
153138
"title": "object (EnumEditor)",
154139
"type": "object",
155140
"enum": [{"name": "Alice"}, {"name": "Bob"}],
156141
"const": {"name": "Bob"},
157-
// "options": { "enforce_const": false }
158142
}
159143
}
160144
}
@@ -170,6 +154,14 @@
170154
editor.on('change', function () {
171155
value.value = JSON.stringify(editor.getValue())
172156
})
157+
158+
editor.on('ready', function () {
159+
editor.getEditor('root.string').setValue('Bob')
160+
editor.getEditor('root.integer').setValue(10)
161+
editor.getEditor('root.number').setValue(10)
162+
editor.getEditor('root.array').setValue([])
163+
editor.getEditor('root.object').setValue({})
164+
})
173165
</script>
174166

175167
</body>

0 commit comments

Comments
 (0)