@@ -878,6 +878,50 @@ describe('end-to-end scatter tests', function() {
878878 . catch ( failTest )
879879 . then ( done ) ;
880880 } ) ;
881+
882+ it ( 'should update axis range accordingly on marker.size edits' , function ( done ) {
883+ function _assert ( msg , xrng , yrng ) {
884+ var fullLayout = gd . _fullLayout ;
885+ expect ( fullLayout . xaxis . range ) . toBeCloseToArray ( xrng , 2 , msg + ' xrng' ) ;
886+ expect ( fullLayout . yaxis . range ) . toBeCloseToArray ( yrng , 2 , msg + ' yrng' ) ;
887+ }
888+
889+ // edit types are important to this test
890+ var schema = Plotly . PlotSchema . get ( ) ;
891+ expect ( schema . traces . scatter . attributes . marker . size . editType )
892+ . toBe ( 'calc' , 'marker.size editType' ) ;
893+ expect ( schema . layout . layoutAttributes . xaxis . autorange . editType )
894+ . toBe ( 'plot' , 'ax autorange editType' ) ;
895+
896+ Plotly . plot ( gd , [ { y : [ 1 , 2 , 1 ] } ] )
897+ . then ( function ( ) {
898+ _assert ( 'auto rng / base marker.size' , [ - 0.13 , 2.13 ] , [ 0.93 , 2.07 ] ) ;
899+ return Plotly . relayout ( gd , {
900+ 'xaxis.range' : [ 0 , 2 ] ,
901+ 'yaxis.range' : [ 0 , 2 ]
902+ } ) ;
903+ } )
904+ . then ( function ( ) {
905+ _assert ( 'set rng / base marker.size' , [ 0 , 2 ] , [ 0 , 2 ] ) ;
906+ return Plotly . restyle ( gd , 'marker.size' , 50 ) ;
907+ } )
908+ . then ( function ( ) {
909+ _assert ( 'set rng / big marker.size' , [ 0 , 2 ] , [ 0 , 2 ] ) ;
910+ return Plotly . relayout ( gd , {
911+ 'xaxis.autorange' : true ,
912+ 'yaxis.autorange' : true
913+ } ) ;
914+ } )
915+ . then ( function ( ) {
916+ _assert ( 'auto rng / big marker.size' , [ - 0.28 , 2.28 ] , [ 0.75 , 2.25 ] ) ;
917+ return Plotly . restyle ( gd , 'marker.size' , null ) ;
918+ } )
919+ . then ( function ( ) {
920+ _assert ( 'auto rng / base marker.size' , [ - 0.13 , 2.13 ] , [ 0.93 , 2.07 ] ) ;
921+ } )
922+ . catch ( failTest )
923+ . then ( done ) ;
924+ } ) ;
881925} ) ;
882926
883927describe ( 'scatter hoverPoints' , function ( ) {
0 commit comments