@@ -59,6 +59,31 @@ describe('Test plot api', function() {
5959 expect ( gd . _context . editable ) . toBe ( true ) ;
6060 } ) . catch ( fail ) . then ( done ) ;
6161 } ) ;
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+ } ) ;
6287 } ) ;
6388
6489 describe ( 'Plotly.relayout' , function ( ) {
0 commit comments