Skip to content

Commit bd34fe8

Browse files
committed
fix stacked area jasmine tests for consistency with updated mock
1 parent cdab9df commit bd34fe8

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

test/image/baselines/stacked_area.png

-12 Bytes
Loading

test/image/mocks/stacked_area.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"data": [
33
{
4-
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "middle", "legendgroup": "m"
4+
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "bottom", "legendgroup": "m"
55
}, {
6-
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "bottom", "legendgroup": "b"
6+
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "middle", "legendgroup": "b"
77
}, {
88
"x": [3, 4 ,5], "y": [1, 2, 1], "line": {"color": "blue"}, "stackgroup": "a", "name": "top", "legendgroup": "t"
99
},
1010

1111
{
12-
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "middle", "legendgroup": "m",
12+
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "bottom", "legendgroup": "m",
1313
"showlegend": false, "xaxis": "x2", "yaxis": "y2"
1414
}, {
15-
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "bottom", "legendgroup": "b",
15+
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "middle", "legendgroup": "b",
1616
"showlegend": false, "xaxis": "x2", "yaxis": "y2",
1717
"stackgaps": "interpolate"
1818
}, {
@@ -21,10 +21,10 @@
2121
},
2222

2323
{
24-
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "b", "name": "middle", "legendgroup": "m",
24+
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "b", "name": "bottom", "legendgroup": "m",
2525
"showlegend": false, "xaxis": "x3", "yaxis": "y3", "mode": "lines+markers"
2626
}, {
27-
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "b", "name": "bottom", "legendgroup": "b",
27+
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "b", "name": "middle", "legendgroup": "b",
2828
"showlegend": false, "xaxis": "x3", "yaxis": "y3", "mode": "lines+markers",
2929
"groupnorm": "fraction"
3030
}, {
@@ -33,22 +33,22 @@
3333
},
3434

3535
{
36-
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "middle", "legendgroup": "m",
36+
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "bottom", "legendgroup": "m",
3737
"showlegend": false, "xaxis": "x4", "yaxis": "y4", "mode": "lines+markers",
3838
"stackgaps": "interpolate", "groupnorm": "fraction"
3939
}, {
40-
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "bottom", "legendgroup": "b",
40+
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "middle", "legendgroup": "b",
4141
"showlegend": false, "xaxis": "x4", "yaxis": "y4", "mode": "lines+markers"
4242
}, {
4343
"x": [3, 4 ,5], "y": [1, 2, 1], "line": {"color": "blue"}, "stackgroup": "a", "name": "top", "legendgroup": "t",
4444
"showlegend": false, "xaxis": "x4", "yaxis": "y4", "mode": "lines+markers"
4545
},
4646

4747
{
48-
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "middle", "legendgroup": "m",
48+
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "bottom", "legendgroup": "m",
4949
"showlegend": false, "xaxis": "x5", "yaxis": "y5"
5050
}, {
51-
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "bottom", "legendgroup": "b",
51+
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "middle", "legendgroup": "b",
5252
"showlegend": false, "xaxis": "x5", "yaxis": "y5"
5353
}, {
5454
"x": [3, 4 ,5], "y": [1, 2, 1], "line": {"color": "blue"}, "stackgroup": "a", "name": "top", "legendgroup": "t",
@@ -57,10 +57,10 @@
5757
},
5858

5959
{
60-
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "middle", "legendgroup": "m",
60+
"x": [2, 5, 6], "y": [1, 3, 4], "line": {"color": "green"}, "stackgroup": "a", "name": "bottom", "legendgroup": "m",
6161
"showlegend": false, "xaxis": "x6", "yaxis": "y6"
6262
}, {
63-
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "bottom", "legendgroup": "b",
63+
"x": [1, 3, 5, 7], "y": [2, 6, 4, 5], "line": {"color": "red"}, "stackgroup": "a", "name": "middle", "legendgroup": "b",
6464
"showlegend": false, "xaxis": "x6", "yaxis": "y6",
6565
"groupnorm": "percent"
6666
}, {

test/jasmine/tests/scatter_test.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,11 @@ describe('stacked area', function() {
11061106
.toBeCloseToArray(ranges[axId], 0.1, msg + ' - ' + axId);
11071107
}
11081108
}
1109+
1110+
var bottoms = [0, 3, 6, 9, 12, 15];
1111+
var middles = [1, 4, 7, 10, 13, 16];
1112+
var midsAndBottoms = bottoms.concat(middles);
1113+
11091114
Plotly.newPlot(gd, Lib.extendDeep({}, mock))
11101115
.then(function() {
11111116
// initial ranges, as in the baseline image
@@ -1120,17 +1125,17 @@ describe('stacked area', function() {
11201125
y3: [0, 1.08], y4: [0, 1.08], y5: [0, 105.26], y6: [0, 105.26]
11211126
}, 'base case');
11221127

1123-
return Plotly.restyle(gd, 'visible', 'legendonly', [0, 3, 6, 9, 12, 15]);
1128+
return Plotly.restyle(gd, 'visible', 'legendonly', middles);
11241129
})
11251130
.then(function() {
11261131
var xr = [2, 6];
11271132
checkRanges({
11281133
x: xr, x2: xr, x3: xr, x4: xr, x5: xr, x6: xr,
11291134
y: [0, 4.21], y2: [0, 5.26],
11301135
y3: [0, 1.08], y4: [0, 1.08], y5: [0, 105.26], y6: [0, 105.26]
1131-
}, 'bottom trace legendonly');
1136+
}, 'middle trace legendonly');
11321137

1133-
return Plotly.restyle(gd, 'visible', false, [0, 3, 6, 9, 12, 15]);
1138+
return Plotly.restyle(gd, 'visible', false, middles);
11341139
})
11351140
.then(function() {
11361141
var xr = [2, 6];
@@ -1140,12 +1145,11 @@ describe('stacked area', function() {
11401145
// which we kept when it was visible: 'legendonly'
11411146
y: [0, 4.21], y2: [0, 4.21],
11421147
y3: [0, 4.32], y4: [0, 1.08], y5: [0, 105.26], y6: [0, 5.26]
1143-
}, 'bottom trace visible: false');
1148+
}, 'middle trace visible: false');
11441149

11451150
// put the bottom traces back to legendonly so they still contribute
11461151
// config attributes, and hide the middles too
1147-
return Plotly.restyle(gd, 'visible', 'legendonly',
1148-
[0, 3, 6, 9, 12, 15, 1, 4, 7, 10, 13, 16]);
1152+
return Plotly.restyle(gd, 'visible', 'legendonly', midsAndBottoms);
11491153
})
11501154
.then(function() {
11511155
var xr = [3, 5];
@@ -1155,20 +1159,20 @@ describe('stacked area', function() {
11551159
y3: [0, 1.08], y4: [0, 1.08], y5: [0, 105.26], y6: [0, 105.26]
11561160
}, 'only top trace showing');
11571161

1158-
return Plotly.restyle(gd, 'visible', true, [0, 3, 6, 9, 12, 15]);
1162+
return Plotly.restyle(gd, 'visible', true, middles);
11591163
})
11601164
.then(function() {
11611165
var xr = [1, 7];
11621166
checkRanges({
11631167
x: xr, x2: xr, x3: xr, x4: xr, x5: xr, x6: xr,
11641168
y: [0, 7.37], y2: [0, 7.37],
11651169
y3: [0, 1.08], y4: [0, 1.08], y5: [0, 105.26], y6: [0, 105.26]
1166-
}, 'top and bottom showing');
1170+
}, 'top and middle showing');
11671171

1168-
return Plotly.restyle(gd, {x: null, y: null}, [0, 3, 6, 9, 12, 15]);
1172+
return Plotly.restyle(gd, {x: null, y: null}, middles);
11691173
})
11701174
.then(function() {
1171-
return Plotly.restyle(gd, 'visible', true, [1, 4, 7, 10, 13, 16]);
1175+
return Plotly.restyle(gd, 'visible', true, bottoms);
11721176
})
11731177
.then(function() {
11741178
var xr = [2, 6];
@@ -1178,7 +1182,7 @@ describe('stacked area', function() {
11781182
x: xr, x2: xr, x3: xr, x4: xr, x5: xr, x6: xr,
11791183
y: [0, 4.21], y2: [0, 4.21],
11801184
y3: [0, 4.32], y4: [0, 1.08], y5: [0, 105.26], y6: [0, 5.26]
1181-
}, 'bottom trace *implicit* visible: false');
1185+
}, 'middle trace *implicit* visible: false');
11821186
})
11831187
.catch(failTest)
11841188
.then(done);

0 commit comments

Comments
 (0)