@@ -169,7 +169,7 @@ describe('Plotly.validate', function() {
169
169
label : '1 month' ,
170
170
step : 'all' ,
171
171
count : 10
172
- } , {
172
+ } , 'wont-work' , {
173
173
title : '1 month'
174
174
} ]
175
175
}
@@ -190,10 +190,25 @@ describe('Plotly.validate', function() {
190
190
} ,
191
191
shapes : [ {
192
192
opacity : 'none'
193
+ } ] ,
194
+ updatemenus : [ {
195
+ buttons : [ {
196
+ method : 'restyle' ,
197
+ args : [ 'marker.color' , 'red' ]
198
+ } ]
199
+ } , 'wont-work' , {
200
+ buttons : [ {
201
+ method : 'restyle' ,
202
+ args : null
203
+ } , {
204
+ method : 'relayout' ,
205
+ args : [ 'marker.color' , 'red' ] ,
206
+ title : 'not-gonna-work'
207
+ } , 'wont-work' ]
193
208
} ]
194
209
} ) ;
195
210
196
- expect ( out . length ) . toEqual ( 7 ) ;
211
+ expect ( out . length ) . toEqual ( 12 ) ;
197
212
assertErrorContent (
198
213
out [ 0 ] , 'schema' , 'layout' , null ,
199
214
[ 'annotations' , 1 , 'arrowSymbol' ] , 'annotations[1].arrowSymbol' ,
@@ -212,27 +227,48 @@ describe('Plotly.validate', function() {
212
227
) ;
213
228
assertErrorContent (
214
229
out [ 3 ] , 'schema' , 'layout' , null ,
215
- [ 'xaxis' , 'rangeselector' , 'buttons' , 1 , 'title' ] ,
216
- 'xaxis.rangeselector.buttons[1 ].title' ,
217
- 'In layout, key xaxis.rangeselector.buttons[1 ].title is not part of the schema'
230
+ [ 'xaxis' , 'rangeselector' , 'buttons' , 2 , 'title' ] ,
231
+ 'xaxis.rangeselector.buttons[2 ].title' ,
232
+ 'In layout, key xaxis.rangeselector.buttons[2 ].title is not part of the schema'
218
233
) ;
219
234
assertErrorContent (
220
- out [ 4 ] , 'schema' , 'layout' , null ,
235
+ out [ 4 ] , 'object' , 'layout' , null ,
236
+ [ 'xaxis' , 'rangeselector' , 'buttons' , 1 ] ,
237
+ 'xaxis.rangeselector.buttons[1]' ,
238
+ 'In layout, key xaxis.rangeselector.buttons[1] must be linked to an object container'
239
+ ) ;
240
+ assertErrorContent (
241
+ out [ 5 ] , 'schema' , 'layout' , null ,
221
242
[ 'xaxis2' , 'rangeselector' , 'buttons' , 0 , 'title' ] ,
222
243
'xaxis2.rangeselector.buttons[0].title' ,
223
244
'In layout, key xaxis2.rangeselector.buttons[0].title is not part of the schema'
224
245
) ;
225
246
assertErrorContent (
226
- out [ 5 ] , 'array' , 'layout' , null ,
247
+ out [ 6 ] , 'array' , 'layout' , null ,
227
248
[ 'xaxis3' , 'rangeselector' , 'buttons' ] ,
228
249
'xaxis3.rangeselector.buttons' ,
229
250
'In layout, key xaxis3.rangeselector.buttons must be linked to an array container'
230
251
) ;
231
252
assertErrorContent (
232
- out [ 6 ] , 'value' , 'layout' , null ,
253
+ out [ 7 ] , 'value' , 'layout' , null ,
233
254
[ 'shapes' , 0 , 'opacity' ] , 'shapes[0].opacity' ,
234
255
'In layout, key shapes[0].opacity is set to an invalid value (none)'
235
256
) ;
257
+ assertErrorContent (
258
+ out [ 8 ] , 'schema' , 'layout' , null ,
259
+ [ 'updatemenus' , 2 , 'buttons' , 1 , 'title' ] , 'updatemenus[2].buttons[1].title' ,
260
+ 'In layout, key updatemenus[2].buttons[1].title is not part of the schema'
261
+ ) ;
262
+ assertErrorContent (
263
+ out [ 9 ] , 'unused' , 'layout' , null ,
264
+ [ 'updatemenus' , 2 , 'buttons' , 0 ] , 'updatemenus[2].buttons[0]' ,
265
+ 'In layout, key updatemenus[2].buttons[0] did not get coerced'
266
+ ) ;
267
+ assertErrorContent (
268
+ out [ 10 ] , 'object' , 'layout' , null ,
269
+ [ 'updatemenus' , 2 , 'buttons' , 2 ] , 'updatemenus[2].buttons[2]' ,
270
+ 'In layout, key updatemenus[2].buttons[2] must be linked to an object container'
271
+ ) ;
236
272
} ) ;
237
273
238
274
it ( 'should work with isSubplotObj attributes' , function ( ) {
0 commit comments