Skip to content

Commit 2f939af

Browse files
committed
plotly#189 updating preexisting test cases in line with PR feedback (if there's no category encountered for a specific categorylist, it should yield null rather than being skipped over)
1 parent f626b08 commit 2f939af

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

test/jasmine/tests/calcdata_test.js

+11-13
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,9 @@ describe('calculated data and points', function() {
5252
Plotly.plot(gd, [{x: ['c','a','e','b','d'], y: [15,11,12,13,14]}], { xaxis: {
5353
type: 'category',
5454
categorymode: 'trace'
55-
// Wouldn't it be preferred to supply a function and plotly would have several functions like this?
56-
// E.g. it's easier for symbol completion (whereas there's no symbol completion on string config)
57-
// See arguments from Mike Bostock, highlighted in medium green here:
58-
// https://medium.com/@mbostock/what-makes-software-good-943557f8a488#eef9
59-
// Plus if it's a function, then users can roll their own.
60-
//
6155
// Also, if axis tick order is made configurable, shouldn't we make trace order configurable?
6256
// Trace order as in, if a line or curve is drawn through points, what's the trace sequence.
63-
// These are two orthogonal concepts. In this round, I'm assuming that the trace order is implied
57+
// These are two orthogonal concepts. Currently, the trace order is implied
6458
// by the order the {x,y} arrays are specified.
6559
}});
6660

@@ -214,11 +208,14 @@ describe('calculated data and points', function() {
214208
categorylist: ['y','b','x','a','d','z','e','c']
215209
}});
216210

217-
expect(gd.calcdata[0][0].y).toEqual(13);
218-
expect(gd.calcdata[0][1].y).toEqual(11);
219-
expect(gd.calcdata[0][2].y).toEqual(14);
220-
expect(gd.calcdata[0][3].y).toEqual(12);
221-
expect(gd.calcdata[0][4].y).toEqual(15);
211+
expect(gd.calcdata[0][0].y).toEqual(null);
212+
expect(gd.calcdata[0][1].y).toEqual(13);
213+
expect(gd.calcdata[0][2].y).toEqual(null);
214+
expect(gd.calcdata[0][3].y).toEqual(11);
215+
expect(gd.calcdata[0][4].y).toEqual(14);
216+
expect(gd.calcdata[0][5].y).toEqual(null);
217+
expect(gd.calcdata[0][6].y).toEqual(12);
218+
expect(gd.calcdata[0][7].y).toEqual(15);
222219
});
223220

224221
it('should output categories in explicitly supplied order first, if not all categories are covered', function() {
@@ -231,7 +228,8 @@ describe('calculated data and points', function() {
231228

232229
expect(gd.calcdata[0][0].y).toEqual(13);
233230
expect(gd.calcdata[0][1].y).toEqual(11);
234-
expect(gd.calcdata[0][2].y).toEqual(15);
231+
expect(gd.calcdata[0][2].y).toEqual(null);
232+
expect(gd.calcdata[0][3].y).toEqual(15);
235233

236234
// The order of the rest is unspecified, no need to check. Alternative: make _both_ categorymode and
237235
// categories effective; categories would take precedence and the remaining items would be sorted

0 commit comments

Comments
 (0)