@@ -26,7 +26,7 @@ describe('plot schema', function() {
26
26
27
27
var VALTYPES = Object . keys ( valObjects ) ;
28
28
var ROLES = [ 'info' , 'style' , 'data' ] ;
29
- var editTypes = plotSchema . defs . editTypes ;
29
+ var editType = plotSchema . defs . editType ;
30
30
31
31
function assertTraceSchema ( callback ) {
32
32
var traces = plotSchema . traces ;
@@ -251,21 +251,21 @@ describe('plot schema', function() {
251
251
252
252
assertTraceSchema ( function ( attr , attrName , attrs , level , attrString ) {
253
253
if ( shouldHaveEditType ( attr , attrName ) ) {
254
- expect ( Lib . validate ( attr . editType , editTypes . traces ) )
254
+ expect ( Lib . validate ( attr . editType , editType . traces ) )
255
255
. toBe ( true , attrString + ': ' + JSON . stringify ( attr . editType ) ) ;
256
256
}
257
257
} ) ;
258
258
259
259
assertTransformSchema ( function ( attr , attrName , attrs , level , attrString ) {
260
260
if ( shouldHaveEditType ( attr , attrName ) ) {
261
- expect ( Lib . validate ( attr . editType , editTypes . traces ) )
261
+ expect ( Lib . validate ( attr . editType , editType . traces ) )
262
262
. toBe ( true , attrString + ': ' + JSON . stringify ( attr . editType ) ) ;
263
263
}
264
264
} ) ;
265
265
266
266
assertLayoutSchema ( function ( attr , attrName , attrs , level , attrString ) {
267
267
if ( shouldHaveEditType ( attr , attrName ) ) {
268
- expect ( Lib . validate ( attr . editType , editTypes . layout ) )
268
+ expect ( Lib . validate ( attr . editType , editType . layout ) )
269
269
. toBe ( true , attrString + ': ' + JSON . stringify ( attr . editType ) ) ;
270
270
}
271
271
} ) ;
@@ -399,7 +399,7 @@ describe('getTraceValObject', function() {
399
399
// for valType: any? (or data_array/arrayOk with just an index)
400
400
[
401
401
'valType' , 'dflt' , 'role' , 'description' , 'arrayOk' ,
402
- 'editTypes ' , 'min' , 'max' , 'values'
402
+ 'editType ' , 'min' , 'max' , 'values'
403
403
] . forEach ( function ( prop ) {
404
404
expect ( getTraceValObject ( { } , [ 'x' , prop ] ) )
405
405
. toBe ( scatter . attributes . x , prop ) ;
@@ -543,3 +543,26 @@ describe('getLayoutValObject', function() {
543
543
expect ( getLayoutValObject ( combinedLayout2 , ticklenParts ) ) . toBe ( gl2dTicklen ) ;
544
544
} ) ;
545
545
} ) ;
546
+
547
+ describe ( 'component schemas' , function ( ) {
548
+ it ( 'does not have yaxis-only attributes or mismatched x/yaxis attributes' , function ( ) {
549
+ // in principle either of these should be allowable, but we don't currently
550
+ // support them so lets simply test that we haven't added them accidentally!
551
+
552
+ function delDescription ( attr ) { delete attr . description ; }
553
+
554
+ for ( var key in Registry . componentsRegistry ) {
555
+ var _module = Registry . componentsRegistry [ key ] ;
556
+ var schema = _module . schema ;
557
+ if ( schema && schema . subplots && schema . subplots . yaxis ) {
558
+ expect ( schema . subplots . xaxis ) . toBeDefined ( _module . name ) ;
559
+
560
+ var xa = Lib . extendDeep ( { } , schema . subplots . xaxis ) ;
561
+ var ya = Lib . extendDeep ( { } , schema . subplots . yaxis ) ;
562
+ Plotly . PlotSchema . crawl ( xa , delDescription ) ;
563
+ Plotly . PlotSchema . crawl ( ya , delDescription ) ;
564
+ expect ( JSON . stringify ( xa ) ) . toBe ( JSON . stringify ( ya ) , _module . name ) ;
565
+ }
566
+ }
567
+ } ) ;
568
+ } ) ;
0 commit comments