From bcd7c0666c80250dd4c78f230032df4facad2c37 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Wed, 22 Aug 2018 11:25:14 -0400 Subject: [PATCH] add zeroline visibility test for overlaying subplots --- test/jasmine/tests/axes_test.js | 43 ++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js index b24f7d3c0b3..a5d91c7718e 100644 --- a/test/jasmine/tests/axes_test.js +++ b/test/jasmine/tests/axes_test.js @@ -2849,7 +2849,7 @@ describe('Test axes', function() { .then(done); }); - it('works with multiple subplots', function(done) { + it('works with multiple coupled subplots', function(done) { Plotly.newPlot(gd, [ {x: [1, 2, 3], y: [1, 2, 3]}, {x: [1, 2, 3], y: [1, 2, 3], xaxis: 'x2'}, @@ -2883,6 +2883,47 @@ describe('Test axes', function() { .catch(failTest) .then(done); }); + + it('works with multiple overlaid subplots', function(done) { + Plotly.newPlot(gd, [ + {x: [1, 2, 3], y: [1, 2, 3]}, + {x: [1, 2, 3], y: [1, 2, 3], xaxis: 'x2', yaxis: 'y2'} + ], { + xaxis: {range: [0, 4], showzeroline: true}, + yaxis: {range: [0, 4], showzeroline: true}, + xaxis2: {range: [0, 4], showzeroline: true, side: 'top', overlaying: 'x'}, + yaxis2: {range: [0, 4], showzeroline: true, side: 'right', overlaying: 'y'}, + width: 600, + height: 600 + }) + .then(function() { + assertZeroLines(['x', 'y', 'x2', 'y2']); + return Plotly.relayout(gd, {'xaxis.showline': true, 'yaxis.showline': true}); + }) + .then(function() { + assertZeroLines([]); + return Plotly.relayout(gd, { + 'xaxis.range': [4, 0], + 'yaxis.range': [4, 0], + 'xaxis2.range': [4, 0], + 'yaxis2.range': [4, 0] + }); + }) + .then(function() { + assertZeroLines(['x', 'y', 'x2', 'y2']); + return Plotly.relayout(gd, { + 'xaxis.showline': false, + 'yaxis.showline': false, + 'xaxis2.showline': true, + 'yaxis2.showline': true + }); + }) + .then(function() { + assertZeroLines([]); + }) + .catch(failTest) + .then(done); + }); }); });