Skip to content

Commit 8efe385

Browse files
authoredOct 11, 2018
Merge pull request #3093 from plotly/aggregate-null-group-fix
Fix aggregate transforms with bad group values
2 parents 5c4094f + 6d158ef commit 8efe385

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
 

‎src/transforms/aggregate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ exports.supplyDefaults = function(transformIn, traceOut) {
164164
if(!Array.isArray(groups)) {
165165
if(!arrayAttrs[groups]) {
166166
transformOut.enabled = false;
167-
return;
167+
return transformOut;
168168
}
169169
arrayAttrs[groups] = 0;
170170
}

‎test/jasmine/tests/transform_aggregate_test.js

+19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var Plotly = require('@lib/index');
22

33
var createGraphDiv = require('../assets/create_graph_div');
44
var destroyGraphDiv = require('../assets/destroy_graph_div');
5+
var failTest = require('../assets/fail_test');
56

67
describe('aggregate', function() {
78
var gd;
@@ -341,4 +342,22 @@ describe('aggregate', function() {
341342
expect(enabledAggregations[2].target).toEqual('marker.color');
342343
expect(enabledAggregations[2]._index).toEqual(-1);
343344
});
345+
346+
it('does not error out on bad *group* value', function(done) {
347+
Plotly.newPlot(gd, [{
348+
y: [16.99, 10.34, 11.01, 23.68, 24.59],
349+
transforms: [{
350+
type: 'aggregate',
351+
groups: null
352+
}]
353+
}])
354+
.then(function() {
355+
var tOut = gd._fullData[0].transforms[0];
356+
expect(tOut.type).toBe('aggregate', 'transform type');
357+
expect(tOut.groups).toBe('x', 'the *groups* default');
358+
expect(tOut.enabled).toBe(false, 'should not be *enabled*');
359+
})
360+
.catch(failTest)
361+
.then(done);
362+
});
344363
});

0 commit comments

Comments
 (0)
Please sign in to comment.