Skip to content

Commit 170dd5d

Browse files
committed
add jasmine test
1 parent 543698a commit 170dd5d

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

test/jasmine/tests/hover_label_test.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5074,6 +5074,83 @@ describe('hovermode: (x|y)unified', function() {
50745074
.then(done, done.fail);
50755075
});
50765076

5077+
it('period scatter points and period bars', function(done) {
5078+
Plotly.newPlot(gd, {
5079+
data: [
5080+
{
5081+
name: 'bar',
5082+
type: 'bar',
5083+
x: ['1999-12', '2000-01', '2000-02'],
5084+
y: [2, 1, 3],
5085+
xhoverformat: '%b',
5086+
xperiod: 'M1'
5087+
},
5088+
{
5089+
name: 'scatter',
5090+
type: 'scatter',
5091+
x: [
5092+
'2000-01-01', '2000-01-06', '2000-01-11', '2000-01-16', '2000-01-21', '2000-01-26',
5093+
'2000-02-01', '2000-02-06', '2000-02-11', '2000-02-16', '2000-02-21', '2000-02-26',
5094+
'2000-03-01', '2000-03-06', '2000-03-11', '2000-03-16', '2000-03-21', '2000-03-26'
5095+
],
5096+
y: [
5097+
1.1, 1.2, 1.3, 1.4, 1.5, 1.6,
5098+
2.1, 2.2, 2.3, 2.4, 2.5, 2.6,
5099+
3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
5100+
],
5101+
xperiod: 24 * 3600 * 1000,
5102+
}
5103+
],
5104+
layout: {
5105+
showlegend: false,
5106+
width: 600,
5107+
height: 400,
5108+
hovermode: 'x unified'
5109+
}
5110+
})
5111+
.then(function(gd) {
5112+
_hover(gd, { xpx: 50, ypx: 200 });
5113+
assertLabel({title: 'Dec', items: [
5114+
'bar : 2'
5115+
]});
5116+
5117+
_hover(gd, { xpx: 100, ypx: 200 });
5118+
assertLabel({title: 'Jan 1, 2000', items: [
5119+
'scatter : 1.1'
5120+
]});
5121+
5122+
_hover(gd, { xpx: 150, ypx: 200 });
5123+
assertLabel({title: 'Jan 11, 2000', items: [
5124+
'bar : (Jan, 1)',
5125+
'scatter : 1.3'
5126+
]});
5127+
5128+
_hover(gd, { xpx: 200, ypx: 200 });
5129+
assertLabel({title: 'Jan 26, 2000', items: [
5130+
'bar : (Jan, 1)',
5131+
'scatter : 1.6'
5132+
]});
5133+
5134+
_hover(gd, { xpx: 250, ypx: 200 });
5135+
assertLabel({title: 'Feb 11, 2000', items: [
5136+
'bar : (Feb, 3)',
5137+
'scatter : 2.3'
5138+
]});
5139+
5140+
_hover(gd, { xpx: 300, ypx: 200 });
5141+
assertLabel({title: 'Feb 21, 2000', items: [
5142+
'bar : (Feb, 3)',
5143+
'scatter : 2.5'
5144+
]});
5145+
5146+
_hover(gd, { xpx: 350, ypx: 200 });
5147+
assertLabel({title: 'Mar 6, 2000', items: [
5148+
'scatter : 3.2'
5149+
]});
5150+
})
5151+
.then(done, done.fail);
5152+
});
5153+
50775154
it('period points alignments', function(done) {
50785155
Plotly.newPlot(gd, {
50795156
data: [

0 commit comments

Comments
 (0)