Skip to content

Commit 040dcd3

Browse files
committed
add jasmine test to lock issue 5290
1 parent 478d421 commit 040dcd3

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

test/jasmine/tests/axes_test.js

+50
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)