@@ -282,29 +282,36 @@ describe('Test plot api', function() {
282282 expect ( gd . _fullData [ 0 ] . marker . color ) . toBe ( colorDflt [ 0 ] ) ;
283283 expect ( gd . _fullData [ 1 ] . marker . color ) . toBe ( colorDflt [ 1 ] ) ;
284284 } ) ;
285+ } ) ;
285286
286- it ( 'should redo auto z/contour when editing z array' , function ( ) {
287- var gd = {
288- data : [ { type : 'contour' , z : [ [ 1 , 2 ] , [ 3 , 4 ] ] } ]
289- } ;
287+ describe ( 'Plotly.restyle unmocked' , function ( ) {
288+ var gd ;
290289
291- mockDefaultsAndCalc ( gd ) ;
290+ beforeEach ( function ( ) {
291+ gd = createGraphDiv ( ) ;
292+ } ) ;
292293
293- expect ( gd . data [ 0 ] . zauto ) . toBe ( true ) ;
294- expect ( gd . data [ 0 ] . zmin ) . toBe ( 1 ) ;
295- expect ( gd . data [ 0 ] . zmax ) . toBe ( 4 ) ;
294+ afterEach ( function ( ) {
295+ destroyGraphDiv ( ) ;
296+ } ) ;
296297
297- expect ( gd . data [ 0 ] . autocontour ) . toBe ( true ) ;
298- expect ( gd . data [ 0 ] . contours ) . toEqual ( { start : 0.5 , end : 3.5 , size : 0.5 } ) ;
298+ it ( 'should redo auto z/contour when editing z array' , function ( ) {
299+ Plotly . plot ( gd , [ { type : 'contour' , z : [ [ 1 , 2 ] , [ 3 , 4 ] ] } ] ) . then ( function ( ) {
300+ expect ( gd . data [ 0 ] . zauto ) . toBe ( true , gd . data [ 0 ] ) ;
301+ expect ( gd . data [ 0 ] . zmin ) . toBe ( 1 ) ;
302+ expect ( gd . data [ 0 ] . zmax ) . toBe ( 4 ) ;
299303
300- Plotly . restyle ( gd , { 'z[0][0]' : 10 } ) ;
304+ expect ( gd . data [ 0 ] . autocontour ) . toBe ( true ) ;
305+ expect ( gd . data [ 0 ] . contours ) . toEqual ( { start : 1.5 , end : 3.5 , size : 0.5 } ) ;
301306
302- expect ( gd . data [ 0 ] . zmin ) . toBe ( 2 ) ;
303- expect ( gd . data [ 0 ] . zmax ) . toBe ( 10 ) ;
307+ return Plotly . restyle ( gd , { 'z[0][0]' : 10 } ) ;
308+ } ) . then ( function ( ) {
309+ expect ( gd . data [ 0 ] . zmin ) . toBe ( 2 ) ;
310+ expect ( gd . data [ 0 ] . zmax ) . toBe ( 10 ) ;
304311
305- expect ( gd . data [ 0 ] . contours ) . toEqual ( { start : 3 , end : 9 , size : 1 } ) ;
312+ expect ( gd . data [ 0 ] . contours ) . toEqual ( { start : 3 , end : 9 , size : 1 } ) ;
313+ } ) ;
306314 } ) ;
307-
308315 } ) ;
309316
310317 describe ( 'Plotly.deleteTraces' , function ( ) {
0 commit comments