Skip to content

Commit fb9b049

Browse files
committed
test for heterogeneous transforms
1 parent 979ddea commit fb9b049

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

test/jasmine/tests/transform_multi_test.js

+49-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ describe('multiple transforms:', function() {
245245
groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'],
246246
styles: [{
247247
target: 'a',
248-
value: {marker: {color: 'red'}},
248+
value: {marker: {color: 'red'}}
249249
}, {
250250
target: 'b',
251251
value: {marker: {color: 'blue'}}
@@ -277,8 +277,56 @@ describe('multiple transforms:', function() {
277277
}]
278278
}];
279279

280+
var mockData2 = [{
281+
x: [1, 2, 3, 4, 5],
282+
y: [2, 3, 1, 7, 9],
283+
marker: {size: [10, 20, 20, 20, 10]},
284+
transforms: [
285+
{
286+
type: 'filter',
287+
operation: '>',
288+
value: 2,
289+
target: 'y'
290+
},
291+
{
292+
type: 'aggregate',
293+
groups: 'marker.size',
294+
aggregations: [
295+
{target: 'x', func: 'sum'}, //20: 6, 10: 5
296+
{target: 'y', func: 'avg'} //20: 5, 10: 9
297+
]
298+
},
299+
{
300+
type: 'filter',
301+
operation: '<',
302+
value: 6,
303+
target: 'x'
304+
}
305+
]
306+
}];
307+
280308
afterEach(destroyGraphDiv);
281309

310+
fit('Plotly.plot should plot the transform traces - filter|aggregate|filter', function(done) {
311+
var data = Lib.extendDeep([], mockData2);
312+
313+
Plotly.plot(gd, data).then(function() {
314+
expect(gd.data.length).toEqual(1);
315+
316+
// this would be the result if we didn't have a second filter
317+
// expect(gd._fullData[0].x).toEqual([6, 5]);
318+
// expect(gd._fullData[0].y).toEqual([5, 9]);
319+
// expect(gd._fullData[0].marker.size).toEqual([20, 10]);
320+
321+
expect(gd._fullData[0].x).toEqual([5]);
322+
expect(gd._fullData[0].y).toEqual([9]);
323+
expect(gd._fullData[0].marker.size).toEqual([10]);
324+
325+
done();
326+
});
327+
});
328+
329+
282330
it('Plotly.plot should plot the transform traces', function(done) {
283331
var data = Lib.extendDeep([], mockData0);
284332

0 commit comments

Comments
 (0)