File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -1433,6 +1433,56 @@ describe('Test axes', function() {
14331433 } ) ;
14341434 } ) ;
14351435
1436+ describe ( 'autorange relayout' , function ( ) {
1437+ var gd ;
1438+
1439+ beforeEach ( function ( ) {
1440+ gd = createGraphDiv ( ) ;
1441+ } ) ;
1442+
1443+ afterEach ( destroyGraphDiv ) ;
1444+
1445+ it ( 'can relayout autorange' , function ( done ) {
1446+ Plotly . newPlot ( gd , {
1447+ data : [ {
1448+ x : [ 0 , 1 ] ,
1449+ y : [ 0 , 1 ]
1450+ } ] ,
1451+ layout : {
1452+ width : 400 ,
1453+ height : 400 ,
1454+ margin : {
1455+ t : 40 ,
1456+ b : 40 ,
1457+ l : 40 ,
1458+ r : 40
1459+ } ,
1460+ xaxis : {
1461+ autorange : false ,
1462+ } ,
1463+ yaxis : {
1464+ autorange : true ,
1465+ }
1466+ }
1467+ } ) . then ( function ( ) {
1468+ expect ( gd . _fullLayout . xaxis . range ) . toEqual ( [ - 1 , 6 ] ) ;
1469+ expect ( gd . _fullLayout . yaxis . range ) . toBeCloseToArray ( [ - 0.07 , 1.07 ] ) ;
1470+
1471+ Plotly . relayout ( gd , 'yaxis.autorange' , false ) ;
1472+ } ) . then ( function ( ) {
1473+ expect ( gd . _fullLayout . yaxis . autorange ) . toBe ( false ) ;
1474+ expect ( gd . _fullLayout . yaxis . range ) . toBeCloseToArray ( [ - 0.07 , 1.07 ] ) ;
1475+
1476+ Plotly . relayout ( gd , 'xaxis.autorange' , true ) ;
1477+ } ) . then ( function ( ) {
1478+ expect ( gd . _fullLayout . xaxis . autorange ) . toBe ( true ) ;
1479+ expect ( gd . _fullLayout . xaxis . range ) . toBeCloseToArray ( [ - 0.07 , 1.07 ] ) ;
1480+ } )
1481+ . catch ( failTest )
1482+ . then ( done ) ;
1483+ } ) ;
1484+ } ) ;
1485+
14361486 describe ( 'constraints relayout' , function ( ) {
14371487 var gd ;
14381488
You can’t perform that action at this time.
0 commit comments