File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
test/jasmine/bundle_tests Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 66* LICENSE file in the root directory of this source tree.
77*/
88
9-
109'use strict' ;
1110
1211var Registry = require ( '../registry' ) ;
@@ -517,6 +516,15 @@ function getTraceAttributes(type) {
517516 out . layoutAttributes = formatAttributes ( layoutAttributes ) ;
518517 }
519518
519+ // drop anim:true in non-animatable modules
520+ if ( ! _module . animatable ) {
521+ exports . crawl ( out , function ( attr ) {
522+ if ( exports . isValObject ( attr ) && 'anim' in attr ) {
523+ delete attr . anim ;
524+ }
525+ } ) ;
526+ }
527+
520528 return out ;
521529}
522530
Original file line number Diff line number Diff line change @@ -377,6 +377,22 @@ describe('plot schema', function() {
377377 expect ( traces . parcoords . attributes . hoverinfo ) . toBe ( undefined , 'no hover attrs for parcoords' ) ;
378378 expect ( traces . scatter3d . attributes . selectedpoints ) . toBe ( undefined , 'no selectedpoints for gl3d traces' ) ;
379379 } ) ;
380+
381+ it ( 'traces that are not animatable should not list `anim:true` attributes' , function ( ) {
382+ var notAnimatable = Object . keys ( plotSchema . traces ) . filter ( function ( traceType ) {
383+ return ! plotSchema . traces [ traceType ] . animatable ;
384+ } ) ;
385+
386+ notAnimatable . forEach ( function ( traceType ) {
387+ Plotly . PlotSchema . crawl ( plotSchema . traces [ traceType ] . attributes , function ( ) {
388+ var attr = arguments [ 0 ] ;
389+ var astr = arguments [ 4 ] ;
390+ if ( Plotly . PlotSchema . isValObject ( attr ) && 'anim' in attr ) {
391+ fail ( 'Trace module ' + traceType + ' sets *' + astr + '* with anim:true' ) ;
392+ }
393+ } ) ;
394+ } ) ;
395+ } ) ;
380396} ) ;
381397
382398describe ( 'getTraceValObject' , function ( ) {
You can’t perform that action at this time.
0 commit comments