@@ -255,6 +255,15 @@ describe('annotations relayout', function() {
255255 anno1 = Lib . extendFlat ( annos [ 1 ] ) ,
256256 anno3 = Lib . extendFlat ( annos [ 3 ] ) ;
257257
258+ // store some (unused) private keys and make sure they are copied over
259+ // correctly during relayout
260+ var fullAnnos = gd . _fullLayout . annotations ;
261+ fullAnnos [ 0 ] . _boo = 'hoo' ;
262+ fullAnnos [ 1 ] . _foo = 'bar' ;
263+ fullAnnos [ 3 ] . _cheese = [ 'gorgonzola' , 'gouda' , 'gloucester' ] ;
264+ // this one gets lost
265+ fullAnnos [ 2 ] . _splat = 'the cat' ;
266+
258267 Plotly . relayout ( gd , {
259268 'annotations[0].text' : 'tortilla' ,
260269 'annotations[0].x' : 3.45 ,
@@ -266,21 +275,35 @@ describe('annotations relayout', function() {
266275 . then ( function ( ) {
267276 expect ( countAnnotations ( ) ) . toEqual ( len ) ;
268277
278+ var fullAnnosAfter = gd . _fullLayout . annotations ,
279+ fullStr = JSON . stringify ( fullAnnosAfter ) ;
280+
269281 assertText ( 0 , 'tortilla' ) ;
270282 anno0 . text = 'tortilla' ;
271283 expect ( annos [ 0 ] ) . toEqual ( anno0 ) ;
284+ expect ( fullAnnosAfter [ 0 ] . _boo ) . toBe ( 'hoo' ) ;
285+
272286
273287 assertText ( 1 , 'chips' ) ;
274288 expect ( annos [ 1 ] ) . toEqual ( { text : 'chips' , x : 1.1 , y : 2.2 } ) ;
289+ expect ( fullAnnosAfter [ 1 ] . _foo ) . toBeUndefined ( ) ;
275290
276291 assertText ( 2 , 'guacamole' ) ;
277292 anno1 . text = 'guacamole' ;
278293 expect ( annos [ 2 ] ) . toEqual ( anno1 ) ;
294+ expect ( fullAnnosAfter [ 2 ] . _foo ) . toBe ( 'bar' ) ;
295+ expect ( fullAnnosAfter [ 2 ] . _splat ) . toBeUndefined ( ) ;
279296
280297 assertText ( 3 , 'lime' ) ;
281298 anno3 . text = 'lime' ;
282299 expect ( annos [ 3 ] ) . toEqual ( anno3 ) ;
300+ expect ( fullAnnosAfter [ 3 ] . _cheese ) . toEqual ( [ 'gorgonzola' , 'gouda' , 'gloucester' ] ) ;
301+
302+ expect ( fullStr . indexOf ( '_splat' ) ) . toBe ( - 1 ) ;
303+ expect ( fullStr . indexOf ( 'the cat' ) ) . toBe ( - 1 ) ;
304+
283305 expect ( Loggers . warn ) . not . toHaveBeenCalled ( ) ;
306+
284307 } )
285308 . catch ( failTest )
286309 . then ( done ) ;
0 commit comments