Skip to content

Commit 0f0ca1f

Browse files
committed
Add jasmine test to validate that hover tool shows correct color regardless of axis direction
1 parent 24c7699 commit 0f0ca1f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/jasmine/tests/image_test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,5 +667,30 @@ describe('image hover:', function() {
667667
.then(done);
668668
});
669669
});
670+
671+
[
672+
['auto', 'auto'],
673+
['auto', 'reversed'],
674+
['reversed', 'auto'],
675+
['reversed', 'reversed']
676+
].forEach(function(test) {
677+
it('should show correct hover info regardless of axis directions ' + test, function(done) {
678+
var mockCopy = Lib.extendDeep({}, mock);
679+
mockCopy.layout.xaxis.autorange = test[0];
680+
mockCopy.layout.yaxis.autorange = test[1];
681+
mockCopy.data[0].colormodel = 'rgba';
682+
mockCopy.data[0].hovertemplate = '%{color}<extra></extra>';
683+
Plotly.newPlot(gd, mockCopy)
684+
.then(function() {_hover(205, 125);})
685+
.then(function() {
686+
assertHoverLabelContent({
687+
nums: '[202, 148, 125, 255]',
688+
name: ''
689+
}, 'variable `z` should be correct!');
690+
})
691+
.catch(failTest)
692+
.then(done);
693+
});
694+
});
670695
});
671696
});

0 commit comments

Comments
 (0)