Skip to content

Commit fa38ca5

Browse files
committed
update cliponaxis: false
... to take into account take now not all trace module layers are added to each subplot.
1 parent a1c76bc commit fa38ca5

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

test/jasmine/tests/bar_test.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,16 +1549,30 @@ describe('bar hover', function() {
15491549
var fig = Lib.extendDeep({}, require('@mocks/bar_cliponaxis-false.json'));
15501550
gd = createGraphDiv();
15511551

1552-
// only show one trace
1552+
// only show one bar trace
15531553
fig.data = [fig.data[0]];
15541554

1555+
// add a non-bar trace to make sure its module layer gets clipped
1556+
fig.data.push({
1557+
type: 'contour',
1558+
z: [[0, 0.5, 1], [0.5, 1, 3]]
1559+
});
1560+
1561+
function _assertClip(sel, exp, size, msg) {
1562+
if(exp === null) {
1563+
expect(sel.size()).toBe(0, msg + 'selection should not exist');
1564+
} else {
1565+
assertClip(sel, exp, size, msg);
1566+
}
1567+
}
1568+
15551569
function _assert(layerClips, barDisplays, barTextDisplays, barClips) {
15561570
var subplotLayer = d3.select('.plot');
15571571
var barLayer = subplotLayer.select('.barlayer');
15581572

1559-
assertClip(subplotLayer, layerClips[0], 1, 'subplot layer');
1560-
assertClip(subplotLayer.select('.maplayer'), layerClips[1], 1, 'some other trace layer');
1561-
assertClip(barLayer, layerClips[2], 1, 'bar layer');
1573+
_assertClip(subplotLayer, layerClips[0], 1, 'subplot layer');
1574+
_assertClip(subplotLayer.select('.contourlayer'), layerClips[1], 1, 'some other trace layer');
1575+
_assertClip(barLayer, layerClips[2], 1, 'bar layer');
15621576

15631577
assertNodeDisplay(
15641578
barLayer.selectAll('.point'),
@@ -1589,7 +1603,7 @@ describe('bar hover', function() {
15891603
})
15901604
.then(function() {
15911605
_assert(
1592-
[true, false, false],
1606+
[true, null, null],
15931607
[],
15941608
[],
15951609
[false, 0]

test/jasmine/tests/scatter_test.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,13 +1231,27 @@ describe('Test scatter *clipnaxis*:', function() {
12311231
// add lines
12321232
fig.data[0].mode = 'markers+lines+text';
12331233

1234+
// add a non-scatter trace to make sure its module layer gets clipped
1235+
fig.data.push({
1236+
type: 'contour',
1237+
z: [[0, 0.5, 1], [0.5, 1, 3]]
1238+
});
1239+
1240+
function _assertClip(sel, exp, size, msg) {
1241+
if(exp === null) {
1242+
expect(sel.size()).toBe(0, msg + 'selection should not exist');
1243+
} else {
1244+
assertClip(sel, exp, size, msg);
1245+
}
1246+
}
1247+
12341248
function _assert(layerClips, nodeDisplays, errorBarClips, lineClips) {
12351249
var subplotLayer = d3.select('.plot');
12361250
var scatterLayer = subplotLayer.select('.scatterlayer');
12371251

1238-
assertClip(subplotLayer, layerClips[0], 1, 'subplot layer');
1239-
assertClip(subplotLayer.select('.maplayer'), layerClips[1], 1, 'some other trace layer');
1240-
assertClip(scatterLayer, layerClips[2], 1, 'scatter layer');
1252+
_assertClip(subplotLayer, layerClips[0], 1, 'subplot layer');
1253+
_assertClip(subplotLayer.select('.contourlayer'), layerClips[1], 1, 'some other trace layer');
1254+
_assertClip(scatterLayer, layerClips[2], 1, 'scatter layer');
12411255

12421256
assertNodeDisplay(
12431257
scatterLayer.selectAll('.point'),
@@ -1274,7 +1288,7 @@ describe('Test scatter *clipnaxis*:', function() {
12741288
})
12751289
.then(function() {
12761290
_assert(
1277-
[true, false, false],
1291+
[true, null, null],
12781292
[],
12791293
[false, 0],
12801294
[false, 0]
@@ -1292,7 +1306,7 @@ describe('Test scatter *clipnaxis*:', function() {
12921306
})
12931307
.then(function() {
12941308
_assert(
1295-
[true, false, false],
1309+
[true, null, null],
12961310
[],
12971311
[false, 0],
12981312
[false, 0]

0 commit comments

Comments
 (0)