Skip to content

Commit f986703

Browse files
committed
add sort vis categorial target test
1 parent ad65c23 commit f986703

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/jasmine/tests/transform_sort_test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,21 @@ describe('Test sort transform calc:', function() {
134134
expect(out[0].y).toEqual([0, 2, 4, 3, 1]);
135135
});
136136

137+
it('should sort via categorical targets', function() {
138+
var trace = extend({
139+
transforms: [{ target: 'marker.size' }]
140+
});
141+
trace.x = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'];
142+
143+
var out = _transform([trace]);
144+
145+
expect(out[0].x).toEqual(['F', 'D', 'C', 'E', 'A', 'G', 'B']);
146+
expect(out[0].y).toEqual([3, 1, 3, 2, 1, 1, 2]);
147+
expect(out[0].ids).toEqual(['p2', 'z', 'n2', 'p1', 'n0', 'p3', 'n1']);
148+
expect(out[0].marker.size).toEqual([0, 1, 5, 6, 10, 10, 20]);
149+
expect(out[0].marker.color).toEqual([0.3, 0.1, 0.3, 0.2, 0.1, 0.4, 0.2]);
150+
});
151+
137152
it('should sort via custom targets', function() {
138153
var out = _transform([extend({
139154
transforms: [{

0 commit comments

Comments
 (0)