Skip to content

Commit 49a9605

Browse files
committed
add test waterfall handle BADNUM positions - can extend the test when transitions are enabled for waterfalls
1 parent c4b811c commit 49a9605

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

test/jasmine/tests/bar_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2932,7 +2932,7 @@ describe('bar tweening', function() {
29322932
.then(done);
29332933
});
29342934

2935-
it('handle NaN positions on vertical bars', function(done) {
2935+
it('handle BADNUM positions on vertical bars', function(done) {
29362936
var y1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
29372937
var y2 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
29382938
var mockCopy = {

test/jasmine/tests/waterfall_test.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var rgb = color.rgb;
1717
var customAssertions = require('../assets/custom_assertions');
1818
var assertHoverLabelContent = customAssertions.assertHoverLabelContent;
1919
var checkTextTemplate = require('../assets/check_texttemplate');
20+
var checkTransition = require('../assets/check_transitions');
2021
var Fx = require('@src/components/fx');
2122

2223
var d3 = require('d3');
@@ -977,6 +978,54 @@ describe('A waterfall plot', function() {
977978
.then(done);
978979
});
979980

981+
it('handle BADNUM positions', function(done) {
982+
var y1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
983+
var y2 = y1; // no transition now
984+
var mockCopy = {
985+
data: [
986+
{
987+
type: 'waterfall',
988+
x: [
989+
0,
990+
1,
991+
'',
992+
'NaN',
993+
NaN,
994+
Infinity,
995+
-Infinity,
996+
undefined,
997+
null,
998+
9,
999+
10
1000+
],
1001+
y: y1
1002+
}
1003+
],
1004+
layout: {
1005+
width: 400,
1006+
height: 300
1007+
}
1008+
};
1009+
1010+
var barTests = [
1011+
[0, '.point path', 'attr', 'd', ['M2,121V109H20V121Z', 'M24,111V98H41V111Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M199,28V15H216V28Z', 'M220,17V5H238V17Z']]
1012+
];
1013+
1014+
var connectorTests = [
1015+
[0, '.line path', 'attr', 'd', ['M20,110H24', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M0,0Z', 'M216,16H220', 'M0,0Z']]
1016+
];
1017+
1018+
var animateOpts = {data: [{y: y2}]};
1019+
var transitionOpts = false; // use default
1020+
1021+
checkTransition(gd, mockCopy, animateOpts, transitionOpts, barTests)
1022+
.then(function() {
1023+
return checkTransition(gd, mockCopy, animateOpts, transitionOpts, connectorTests);
1024+
})
1025+
.catch(failTest)
1026+
.then(done);
1027+
});
1028+
9801029
it('should be able to deal with transform that empty out the data coordinate arrays', function(done) {
9811030
Plotly.plot(gd, {
9821031
data: [{

0 commit comments

Comments
 (0)