@@ -59,6 +59,31 @@ describe('Test plot api', function() {
59
59
expect ( gd . _context . editable ) . toBe ( true ) ;
60
60
} ) . catch ( fail ) . then ( done ) ;
61
61
} ) ;
62
+
63
+ it ( 'allows adding more frames to the initial set' , function ( done ) {
64
+ Plotly . plot ( gd , {
65
+ data : [ { x : [ 1 , 2 , 3 ] , y : [ 1 , 2 , 3 ] } ] ,
66
+ layout : { width : 500 , height : 500 } ,
67
+ config : { editable : true } ,
68
+ frames : [ { y : [ 7 , 7 , 7 ] , name : 'frame1' } ]
69
+ } ) . then ( function ( ) {
70
+ expect ( gd . layout . width ) . toEqual ( 500 ) ;
71
+ expect ( gd . layout . height ) . toEqual ( 500 ) ;
72
+ expect ( gd . data . length ) . toEqual ( 1 ) ;
73
+ expect ( gd . _transitionData . _frames . length ) . toEqual ( 1 ) ;
74
+ expect ( gd . _context . editable ) . toBe ( true ) ;
75
+
76
+ return Plotly . addFrames ( gd , [
77
+ { y : [ 8 , 8 , 8 ] , name : 'frame2' } ,
78
+ { y : [ 9 , 9 , 9 ] , name : 'frame3' }
79
+ ] ) ;
80
+ } ) . then ( function ( ) {
81
+ expect ( gd . _transitionData . _frames . length ) . toEqual ( 3 ) ;
82
+ expect ( gd . _transitionData . _frames [ 0 ] . name ) . toEqual ( 'frame1' ) ;
83
+ expect ( gd . _transitionData . _frames [ 1 ] . name ) . toEqual ( 'frame2' ) ;
84
+ expect ( gd . _transitionData . _frames [ 2 ] . name ) . toEqual ( 'frame3' ) ;
85
+ } ) . catch ( fail ) . then ( done ) ;
86
+ } ) ;
62
87
} ) ;
63
88
64
89
describe ( 'Plotly.relayout' , function ( ) {
0 commit comments