@@ -161,17 +161,55 @@ describe('merge.js', () => {
161
161
162
162
var merged = merge ( subschema , [ { key : 'sub' , readonly : true } ] ) ;
163
163
164
- //sub
164
+ //sub
165
165
merged [ 0 ] . should . have . property ( 'readonly' ) ;
166
166
merged [ 0 ] . readonly . should . eq ( true ) ;
167
167
168
- //array
168
+ //array
169
169
merged [ 0 ] . items [ 0 ] . should . have . property ( 'readonly' ) ;
170
170
merged [ 0 ] . items [ 0 ] . readonly . should . eq ( true ) ;
171
171
172
- //array items
172
+ //array items
173
173
merged [ 0 ] . items [ 0 ] . items [ 0 ] . should . have . property ( 'readonly' ) ;
174
174
merged [ 0 ] . items [ 0 ] . items [ 0 ] . readonly . should . eq ( true ) ;
175
175
} ) ;
176
+
177
+ it ( 'should add x-schema-form properties' , ( ) => {
178
+ let subschema = {
179
+ "type" : "object" ,
180
+ "properties" : {
181
+ "comment" : {
182
+ "type" : "string" ,
183
+ "title" : "Comment" ,
184
+ "x-schema-form" : {
185
+ "type" : "textarea" ,
186
+ "placeholder" : "Don't hold back"
187
+ }
188
+ }
189
+ }
190
+ } ;
191
+
192
+ var merged = merge ( subschema , [ '*' ] ) ;
193
+
194
+ merged . should . deep . eq (
195
+ [
196
+ {
197
+ "title" : "Comment" ,
198
+ "schema" : {
199
+ "type" : "string" ,
200
+ "title" :"Comment" ,
201
+ "x-schema-form" : {
202
+ "type" : "textarea" ,
203
+ "placeholder" : "Don't hold back"
204
+ }
205
+ } ,
206
+ "ngModelOptions" : { } ,
207
+ "key" : [ "comment" ] ,
208
+ "type" : "textarea" ,
209
+ "placeholder" : "Don't hold back"
210
+ }
211
+ ]
212
+ )
213
+ } ) ;
176
214
} ) ;
177
215
} ) ;
0 commit comments