Skip to content

Commit ee1f8c4

Browse files
committed
jasmine test of pie agg with or without values
1 parent 4ba0249 commit ee1f8c4

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/jasmine/tests/pie_test.js

+27
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,33 @@ describe('Pie traces:', function() {
6565
.catch(failTest)
6666
.then(done);
6767
});
68+
69+
it('can sum values or count labels', function(done) {
70+
Plotly.newPlot(gd, [{
71+
labels: ['a', 'b', 'c', 'a', 'b', 'a'],
72+
values: [1, 2, 3, 4, 5, 6],
73+
type: 'pie',
74+
domain: {x: [0, 0.45]}
75+
}, {
76+
labels: ['d', 'e', 'f', 'd', 'e', 'd'],
77+
type: 'pie',
78+
domain: {x: [0.55, 1]}
79+
}])
80+
.then(function() {
81+
var expected = [
82+
[['a', 11], ['b', 7], ['c', 3]],
83+
[['d', 3], ['e', 2], ['f', 1]]
84+
];
85+
for(var i = 0; i < 2; i++) {
86+
for(var j = 0; j < 3; j++) {
87+
expect(gd.calcdata[i][j].label).toBe(expected[i][j][0], i + ',' + j);
88+
expect(gd.calcdata[i][j].v).toBe(expected[i][j][1], i + ',' + j);
89+
}
90+
}
91+
})
92+
.catch(failTest)
93+
.then(done);
94+
});
6895
});
6996

7097
describe('pie hovering', function() {

0 commit comments

Comments
 (0)