Skip to content

Commit 1ea2fd7

Browse files
committed
PR feedback: test with empty grouping information
1 parent 1dd93bb commit 1ea2fd7

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

test/jasmine/tests/transform_groupby_test.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,4 +522,56 @@ describe('groupby', function() {
522522

523523
});
524524

525+
describe('passes with no `groups`', function() {
526+
'use strict';
527+
528+
afterEach(destroyGraphDiv);
529+
530+
var mockData = [{
531+
mode: 'markers+lines',
532+
ids: ['q', 'w', 'r', 't', 'y', 'u', 'i'],
533+
x: [1, -1, -2, 0, 1, 2, 3],
534+
y: [0, 1, 2, 3, 5, 4, 6],
535+
marker: {size: 20, line: {width: [4, 2, 4, 2, 2, 3, 3]}},
536+
transforms: [{
537+
type: 'groupby',
538+
//groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'],
539+
style: { a: {marker: {color: 'red'}}, b: {marker: {color: 'blue'}} }
540+
}]
541+
}];
542+
543+
it("passes", function(done) {
544+
var data = Lib.extendDeep([], mockData);
545+
546+
var gd = createGraphDiv();
547+
548+
Plotly.plot(gd, data).then(function() {
549+
550+
/*
551+
expect(gd.data.length).toEqual(1);
552+
expect(gd.data[0].ids).toEqual(['q', 'w', 'r', 't', 'y', 'u', 'i']);
553+
expect(gd.data[0].x).toEqual([1, -1, -2, 0, 1, 2, 3]);
554+
expect(gd.data[0].y).toEqual([0, 1, 2, 3, 5, 4, 6]);
555+
expect(gd.data[0].marker.line.width).toEqual([4, 2, 4, 2, 2, 3, 3]);
556+
557+
expect(gd._fullData.length).toEqual(2);
558+
559+
expect(gd._fullData[0].ids).toEqual(['q', 'w', 't', 'i']);
560+
expect(gd._fullData[0].x).toEqual([1, -1, 0, 3]);
561+
expect(gd._fullData[0].y).toEqual([0, 1, 3, 6]);
562+
expect(gd._fullData[0].marker.line.width).toEqual([4, 2, 2, 3]);
563+
564+
expect(gd._fullData[1].ids).toEqual(['r', 'y', 'u']);
565+
expect(gd._fullData[1].x).toEqual([-2, 1, 2]);
566+
expect(gd._fullData[1].y).toEqual([2, 5, 4]);
567+
expect(gd._fullData[1].marker.line.width).toEqual([4, 2, 3]);
568+
569+
assertDims([4, 3]);
570+
*/
571+
572+
done();
573+
});
574+
});
575+
576+
});
525577
});

0 commit comments

Comments
 (0)