@@ -169,7 +169,7 @@ describe('Plotly.validate', function() {
169169 label : '1 month' ,
170170 step : 'all' ,
171171 count : 10
172- } , {
172+ } , 'wont-work' , {
173173 title : '1 month'
174174 } ]
175175 }
@@ -190,10 +190,25 @@ describe('Plotly.validate', function() {
190190 } ,
191191 shapes : [ {
192192 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' ]
193208 } ]
194209 } ) ;
195210
196- expect ( out . length ) . toEqual ( 7 ) ;
211+ expect ( out . length ) . toEqual ( 12 ) ;
197212 assertErrorContent (
198213 out [ 0 ] , 'schema' , 'layout' , null ,
199214 [ 'annotations' , 1 , 'arrowSymbol' ] , 'annotations[1].arrowSymbol' ,
@@ -212,27 +227,48 @@ describe('Plotly.validate', function() {
212227 ) ;
213228 assertErrorContent (
214229 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'
218233 ) ;
219234 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 ,
221242 [ 'xaxis2' , 'rangeselector' , 'buttons' , 0 , 'title' ] ,
222243 'xaxis2.rangeselector.buttons[0].title' ,
223244 'In layout, key xaxis2.rangeselector.buttons[0].title is not part of the schema'
224245 ) ;
225246 assertErrorContent (
226- out [ 5 ] , 'array' , 'layout' , null ,
247+ out [ 6 ] , 'array' , 'layout' , null ,
227248 [ 'xaxis3' , 'rangeselector' , 'buttons' ] ,
228249 'xaxis3.rangeselector.buttons' ,
229250 'In layout, key xaxis3.rangeselector.buttons must be linked to an array container'
230251 ) ;
231252 assertErrorContent (
232- out [ 6 ] , 'value' , 'layout' , null ,
253+ out [ 7 ] , 'value' , 'layout' , null ,
233254 [ 'shapes' , 0 , 'opacity' ] , 'shapes[0].opacity' ,
234255 'In layout, key shapes[0].opacity is set to an invalid value (none)'
235256 ) ;
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+ ) ;
236272 } ) ;
237273
238274 it ( 'should work with isSubplotObj attributes' , function ( ) {
0 commit comments