Skip to content

Commit 2391afd

Browse files
committed
Extend zindex test to waterfall and funnel traces
1 parent eabedd8 commit 2391afd

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

Diff for: test/image/baselines/zindex_basic.png

1.45 KB
Loading

Diff for: test/jasmine/tests/cartesian_interact_test.js

+30-23
Original file line numberDiff line numberDiff line change
@@ -2694,28 +2694,35 @@ describe('Cartesian taces with zindex', function() {
26942694
.then(done, done.fail);
26952695
});
26962696

2697-
it('should display bar traces in ascending order', function(done) {
2698-
Plotly.newPlot(gd, fig(barData))
2699-
.then(function() {
2700-
var data = gd._fullData;
2701-
assertZIndices(data, barData);
2702-
var tracesData = d3SelectAll('g[class^="barlayer"]');
2703-
assertZIndicesSorted(tracesData[0]);
2704-
})
2705-
.then(function() {
2706-
return Plotly.restyle(gd, 'barmode', 'overlay');
2707-
})
2708-
.then(function() {
2709-
var tracesData = d3SelectAll('g[class^="barlayer"]');
2710-
assertZIndicesSorted(tracesData[0]);
2711-
})
2712-
.then(function() {
2713-
return Plotly.restyle(gd, 'barmode', 'stack');
2714-
})
2715-
.then(function() {
2716-
var tracesData = d3SelectAll('g[class^="barlayer"]');
2717-
assertZIndicesSorted(tracesData[0]);
2718-
})
2719-
.then(done, done.fail);
2697+
['bar', 'waterfall', 'funnel'].forEach(function(traceType) {
2698+
it('should display ' + traceType + ' traces in ascending order', function(done) {
2699+
var _Data = [
2700+
{x: [1, 2], y: [2, 4], type: traceType},
2701+
{x: [1, 2], y: [4, 2], type: traceType, zindex: -10}
2702+
];
2703+
var _Class = 'g[class^="' + traceType + 'layer"]';
2704+
Plotly.newPlot(gd, fig(_Data))
2705+
.then(function() {
2706+
var data = gd._fullData;
2707+
assertZIndices(data, _Data);
2708+
var tracesData = d3SelectAll(_Class);
2709+
assertZIndicesSorted(tracesData[0]);
2710+
})
2711+
.then(function() {
2712+
return Plotly.restyle(gd, 'barmode', 'overlay');
2713+
})
2714+
.then(function() {
2715+
var tracesData = d3SelectAll(_Class);
2716+
assertZIndicesSorted(tracesData[0]);
2717+
})
2718+
.then(function() {
2719+
return Plotly.restyle(gd, 'barmode', 'stack');
2720+
})
2721+
.then(function() {
2722+
var tracesData = d3SelectAll(_Class);
2723+
assertZIndicesSorted(tracesData[0]);
2724+
})
2725+
.then(done, done.fail);
2726+
});
27202727
});
27212728
});

0 commit comments

Comments
 (0)