Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e625c44

Browse files
committed
1st cut violin jasmine tests
1 parent e737664 commit e625c44

File tree

2 files changed

+406
-0
lines changed

2 files changed

+406
-0
lines changed

test/jasmine/tests/select_test.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,58 @@ describe('Test select box and lasso per trace:', function() {
971971
.catch(fail)
972972
.then(done);
973973
});
974+
975+
it('should work for violin traces', function(done) {
976+
var assertPoints = makeAssertPoints(['curveNumber', 'y', 'x']);
977+
var assertRanges = makeAssertRanges();
978+
var assertLassoPoints = makeAssertLassoPoints();
979+
980+
var fig = Lib.extendDeep({}, require('@mocks/violin_grouped'));
981+
fig.layout.dragmode = 'lasso';
982+
fig.layout.width = 600;
983+
fig.layout.height = 500;
984+
addInvisible(fig);
985+
986+
Plotly.plot(gd, fig)
987+
.then(function() {
988+
return _run(
989+
[[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]],
990+
function() {
991+
assertPoints([
992+
[0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], [0, 0.9, 'day 2'],
993+
[1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], [1, 0.8, 'day 2'],
994+
[1, 0.9, 'day 2'],
995+
[2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'], [2, 0.9, 'day 1']
996+
]);
997+
assertLassoPoints([
998+
['day 1', 'day 2', 'day 2', 'day 1', 'day 1'],
999+
[1.02, 1.02, 0.27, 0.27, 1.02]
1000+
]);
1001+
},
1002+
null, LASSOEVENTS, 'violin lasso'
1003+
);
1004+
})
1005+
.then(function() {
1006+
return Plotly.relayout(gd, 'dragmode', 'select');
1007+
})
1008+
.then(function() {
1009+
return _run(
1010+
[[200, 200], [400, 350]],
1011+
function() {
1012+
assertPoints([
1013+
[0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], [0, 0.9, 'day 2'],
1014+
[1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], [1, 0.8, 'day 2'],
1015+
[1, 0.9, 'day 2'],
1016+
[2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'], [2, 0.9, 'day 1']
1017+
]);
1018+
assertRanges([['day 1', 'day 2'], [0.27, 1.02]]);
1019+
},
1020+
null, BOXEVENTS, 'violin select'
1021+
);
1022+
})
1023+
.catch(fail)
1024+
.then(done);
1025+
});
9741026
});
9751027

9761028
// to make sure none of the above tests fail with extraneous invisible traces,

0 commit comments

Comments
 (0)