Skip to content

Commit bcd7c06

Browse files
committed
add zeroline visibility test for overlaying subplots
1 parent 545ad47 commit bcd7c06

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

test/jasmine/tests/axes_test.js

+42-1
Original file line numberDiff line numberDiff line change
@@ -2849,7 +2849,7 @@ describe('Test axes', function() {
28492849
.then(done);
28502850
});
28512851

2852-
it('works with multiple subplots', function(done) {
2852+
it('works with multiple coupled subplots', function(done) {
28532853
Plotly.newPlot(gd, [
28542854
{x: [1, 2, 3], y: [1, 2, 3]},
28552855
{x: [1, 2, 3], y: [1, 2, 3], xaxis: 'x2'},
@@ -2883,6 +2883,47 @@ describe('Test axes', function() {
28832883
.catch(failTest)
28842884
.then(done);
28852885
});
2886+
2887+
it('works with multiple overlaid subplots', function(done) {
2888+
Plotly.newPlot(gd, [
2889+
{x: [1, 2, 3], y: [1, 2, 3]},
2890+
{x: [1, 2, 3], y: [1, 2, 3], xaxis: 'x2', yaxis: 'y2'}
2891+
], {
2892+
xaxis: {range: [0, 4], showzeroline: true},
2893+
yaxis: {range: [0, 4], showzeroline: true},
2894+
xaxis2: {range: [0, 4], showzeroline: true, side: 'top', overlaying: 'x'},
2895+
yaxis2: {range: [0, 4], showzeroline: true, side: 'right', overlaying: 'y'},
2896+
width: 600,
2897+
height: 600
2898+
})
2899+
.then(function() {
2900+
assertZeroLines(['x', 'y', 'x2', 'y2']);
2901+
return Plotly.relayout(gd, {'xaxis.showline': true, 'yaxis.showline': true});
2902+
})
2903+
.then(function() {
2904+
assertZeroLines([]);
2905+
return Plotly.relayout(gd, {
2906+
'xaxis.range': [4, 0],
2907+
'yaxis.range': [4, 0],
2908+
'xaxis2.range': [4, 0],
2909+
'yaxis2.range': [4, 0]
2910+
});
2911+
})
2912+
.then(function() {
2913+
assertZeroLines(['x', 'y', 'x2', 'y2']);
2914+
return Plotly.relayout(gd, {
2915+
'xaxis.showline': false,
2916+
'yaxis.showline': false,
2917+
'xaxis2.showline': true,
2918+
'yaxis2.showline': true
2919+
});
2920+
})
2921+
.then(function() {
2922+
assertZeroLines([]);
2923+
})
2924+
.catch(failTest)
2925+
.then(done);
2926+
});
28862927
});
28872928
});
28882929

0 commit comments

Comments
 (0)