Skip to content

Commit bb67741

Browse files
committed
add jasmine test
1 parent 969420f commit bb67741

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

test/jasmine/tests/hover_label_test.js

+49
Original file line numberDiff line numberDiff line change
@@ -4674,6 +4674,55 @@ describe('hovermode: (x|y)unified', function() {
46744674
.then(done, done.fail);
46754675
});
46764676

4677+
it('should display hover for scatter and bars at various intervals', function(done) {
4678+
Plotly.newPlot(gd, {
4679+
data: [{
4680+
name: 'bar',
4681+
type: 'bar',
4682+
y: [10, 30]
4683+
}, {
4684+
name: 'scatter',
4685+
type: 'scatter',
4686+
x: [0, 0.2, 0.4, 0.6, 0.8, 1],
4687+
y: [21, 22, 23, 24, 25, 26]
4688+
}],
4689+
layout: {
4690+
hovermode: 'x unified',
4691+
showlegend: false,
4692+
width: 500,
4693+
height: 500,
4694+
margin: {
4695+
t: 50,
4696+
b: 50,
4697+
l: 50,
4698+
r: 50
4699+
}
4700+
}
4701+
})
4702+
.then(function() {
4703+
_hover(gd, { xpx: 100, ypx: 200 });
4704+
assertLabel({title: '0', items: [
4705+
'bar : 10',
4706+
'scatter : 21'
4707+
]});
4708+
})
4709+
.then(function() {
4710+
_hover(gd, { xpx: 200, ypx: 200 });
4711+
assertLabel({title: '0.6', items: [
4712+
'bar : (1, 30)',
4713+
'scatter : 24'
4714+
]});
4715+
})
4716+
.then(function() {
4717+
_hover(gd, { xpx: 300, ypx: 200 });
4718+
assertLabel({title: '1', items: [
4719+
'bar : 30',
4720+
'scatter : 26'
4721+
]});
4722+
})
4723+
.then(done, done.fail);
4724+
});
4725+
46774726
it('case of scatter points on period bars', function(done) {
46784727
Plotly.newPlot(gd, {
46794728
data: [

0 commit comments

Comments
 (0)