Skip to content

Commit 5ad6b5c

Browse files
committed
plotly#189 baseline test case based on codepen pointed to by @etpinard
1 parent a806ca2 commit 5ad6b5c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/jasmine/tests/calcdata_test.js

+36
Original file line numberDiff line numberDiff line change
@@ -290,5 +290,41 @@ describe('calculated data and points', function() {
290290
// behavior, rather than an explicit 'explicit' categorymode.
291291
});
292292
});
293+
294+
describe('ordering tests in the presence of multiple traces', function() {
295+
296+
it('baseline testing for the unordered, disjunct case', function() {
297+
298+
var x1 = ['Gear', 'Bearing', 'Motor'];
299+
var x2 = ['Switch', 'Plug', 'Cord', 'Fuse', 'Bulb'];
300+
var x3 = ['Pump', 'Leak', 'Seals'];
301+
302+
Plotly.plot(gd, [{
303+
x: x1,
304+
y: x1.map(function(d, i) {return i + 10;})
305+
}, {
306+
x: x2,
307+
y: x2.map(function(d, i) {return i + 20;})
308+
}, {
309+
x: x3,
310+
y: x3.map(function(d, i) {return i + 30;})
311+
}]);
312+
313+
expect(gd.calcdata[0][0]).toEqual(jasmine.objectContaining({x: 0, y: 10}));
314+
expect(gd.calcdata[0][1]).toEqual(jasmine.objectContaining({x: 1, y: 11}));
315+
expect(gd.calcdata[0][2]).toEqual(jasmine.objectContaining({x: 2, y: 12}));
316+
317+
expect(gd.calcdata[1][0]).toEqual(jasmine.objectContaining({x: 3, y: 20}));
318+
expect(gd.calcdata[1][1]).toEqual(jasmine.objectContaining({x: 4, y: 21}));
319+
expect(gd.calcdata[1][2]).toEqual(jasmine.objectContaining({x: 5, y: 22}));
320+
expect(gd.calcdata[1][3]).toEqual(jasmine.objectContaining({x: 6, y: 23}));
321+
expect(gd.calcdata[1][4]).toEqual(jasmine.objectContaining({x: 7, y: 24}));
322+
323+
expect(gd.calcdata[2][0]).toEqual(jasmine.objectContaining({x: 8, y: 30}));
324+
expect(gd.calcdata[2][1]).toEqual(jasmine.objectContaining({x: 9, y: 31}));
325+
expect(gd.calcdata[2][2]).toEqual(jasmine.objectContaining({x: 10, y: 32}));
326+
});
327+
328+
});
293329
});
294330
});

0 commit comments

Comments
 (0)