Skip to content

Commit 4f80d95

Browse files
committed
merge two tests
1 parent 170dd5d commit 4f80d95

File tree

1 file changed

+77
-143
lines changed

1 file changed

+77
-143
lines changed

test/jasmine/tests/hover_label_test.js

Lines changed: 77 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -4998,157 +4998,91 @@ describe('hovermode: (x|y)unified', function() {
49984998
.then(done, done.fail);
49994999
});
50005000

5001-
it('non-period points winning hover', function(done) {
5002-
Plotly.newPlot(gd, {
5003-
data: [
5004-
{
5005-
name: 'bar',
5006-
type: 'bar',
5007-
x: ['1999-12', '2000-01', '2000-02'],
5008-
y: [2, 1, 3],
5009-
xhoverformat: '%b',
5010-
xperiod: 'M1'
5011-
},
5012-
{
5013-
name: 'scatter',
5014-
type: 'scatter',
5015-
x: [
5016-
'2000-01-01', '2000-01-06', '2000-01-11', '2000-01-16', '2000-01-21', '2000-01-26',
5017-
'2000-02-01', '2000-02-06', '2000-02-11', '2000-02-16', '2000-02-21', '2000-02-26',
5018-
'2000-03-01', '2000-03-06', '2000-03-11', '2000-03-16', '2000-03-21', '2000-03-26'
5019-
],
5020-
y: [
5021-
1.1, 1.2, 1.3, 1.4, 1.5, 1.6,
5022-
2.1, 2.2, 2.3, 2.4, 2.5, 2.6,
5023-
3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
5024-
]
5001+
[{
5002+
xperiod: 0,
5003+
desc: 'non-period scatter points and period bars'
5004+
}, {
5005+
xperiod: 24 * 3600 * 1000,
5006+
desc: 'period scatter points and period bars'
5007+
}].forEach(function(t) {
5008+
it(t.desc, function(done) {
5009+
var fig = {
5010+
data: [
5011+
{
5012+
name: 'bar',
5013+
type: 'bar',
5014+
x: ['1999-12', '2000-01', '2000-02'],
5015+
y: [2, 1, 3],
5016+
xhoverformat: '%b',
5017+
xperiod: 'M1'
5018+
},
5019+
{
5020+
xperiod: t.xperiod,
5021+
name: 'scatter',
5022+
type: 'scatter',
5023+
x: [
5024+
'2000-01-01', '2000-01-06', '2000-01-11', '2000-01-16', '2000-01-21', '2000-01-26',
5025+
'2000-02-01', '2000-02-06', '2000-02-11', '2000-02-16', '2000-02-21', '2000-02-26',
5026+
'2000-03-01', '2000-03-06', '2000-03-11', '2000-03-16', '2000-03-21', '2000-03-26'
5027+
],
5028+
y: [
5029+
1.1, 1.2, 1.3, 1.4, 1.5, 1.6,
5030+
2.1, 2.2, 2.3, 2.4, 2.5, 2.6,
5031+
3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
5032+
]
5033+
}
5034+
],
5035+
layout: {
5036+
showlegend: false,
5037+
width: 600,
5038+
height: 400,
5039+
hovermode: 'x unified'
50255040
}
5026-
],
5027-
layout: {
5028-
showlegend: false,
5029-
width: 600,
5030-
height: 400,
5031-
hovermode: 'x unified'
5032-
}
5033-
})
5034-
.then(function(gd) {
5035-
_hover(gd, { xpx: 50, ypx: 200 });
5036-
assertLabel({title: 'Dec', items: [
5037-
'bar : 2'
5038-
]});
5039-
5040-
_hover(gd, { xpx: 100, ypx: 200 });
5041-
assertLabel({title: 'Jan 1, 2000', items: [
5042-
'scatter : 1.1'
5043-
]});
5044-
5045-
_hover(gd, { xpx: 150, ypx: 200 });
5046-
assertLabel({title: 'Jan 11, 2000', items: [
5047-
'bar : (Jan, 1)',
5048-
'scatter : 1.3'
5049-
]});
5050-
5051-
_hover(gd, { xpx: 200, ypx: 200 });
5052-
assertLabel({title: 'Jan 26, 2000', items: [
5053-
'bar : (Jan, 1)',
5054-
'scatter : 1.6'
5055-
]});
5056-
5057-
_hover(gd, { xpx: 250, ypx: 200 });
5058-
assertLabel({title: 'Feb 11, 2000', items: [
5059-
'bar : (Feb, 3)',
5060-
'scatter : 2.3'
5061-
]});
5062-
5063-
_hover(gd, { xpx: 300, ypx: 200 });
5064-
assertLabel({title: 'Feb 21, 2000', items: [
5065-
'bar : (Feb, 3)',
5066-
'scatter : 2.5'
5067-
]});
5068-
5069-
_hover(gd, { xpx: 350, ypx: 200 });
5070-
assertLabel({title: 'Mar 6, 2000', items: [
5071-
'scatter : 3.2'
5072-
]});
5073-
})
5074-
.then(done, done.fail);
5075-
});
5041+
};
50765042

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-
]});
5043+
Plotly.newPlot(gd, fig)
5044+
.then(function(gd) {
5045+
_hover(gd, { xpx: 50, ypx: 200 });
5046+
assertLabel({title: 'Dec', items: [
5047+
'bar : 2'
5048+
]});
51165049

5117-
_hover(gd, { xpx: 100, ypx: 200 });
5118-
assertLabel({title: 'Jan 1, 2000', items: [
5119-
'scatter : 1.1'
5120-
]});
5050+
_hover(gd, { xpx: 100, ypx: 200 });
5051+
assertLabel({title: 'Jan 1, 2000', items: [
5052+
'scatter : 1.1'
5053+
]});
51215054

5122-
_hover(gd, { xpx: 150, ypx: 200 });
5123-
assertLabel({title: 'Jan 11, 2000', items: [
5124-
'bar : (Jan, 1)',
5125-
'scatter : 1.3'
5126-
]});
5055+
_hover(gd, { xpx: 150, ypx: 200 });
5056+
assertLabel({title: 'Jan 11, 2000', items: [
5057+
'bar : (Jan, 1)',
5058+
'scatter : 1.3'
5059+
]});
51275060

5128-
_hover(gd, { xpx: 200, ypx: 200 });
5129-
assertLabel({title: 'Jan 26, 2000', items: [
5130-
'bar : (Jan, 1)',
5131-
'scatter : 1.6'
5132-
]});
5061+
_hover(gd, { xpx: 200, ypx: 200 });
5062+
assertLabel({title: 'Jan 26, 2000', items: [
5063+
'bar : (Jan, 1)',
5064+
'scatter : 1.6'
5065+
]});
51335066

5134-
_hover(gd, { xpx: 250, ypx: 200 });
5135-
assertLabel({title: 'Feb 11, 2000', items: [
5136-
'bar : (Feb, 3)',
5137-
'scatter : 2.3'
5138-
]});
5067+
_hover(gd, { xpx: 250, ypx: 200 });
5068+
assertLabel({title: 'Feb 11, 2000', items: [
5069+
'bar : (Feb, 3)',
5070+
'scatter : 2.3'
5071+
]});
51395072

5140-
_hover(gd, { xpx: 300, ypx: 200 });
5141-
assertLabel({title: 'Feb 21, 2000', items: [
5142-
'bar : (Feb, 3)',
5143-
'scatter : 2.5'
5144-
]});
5073+
_hover(gd, { xpx: 300, ypx: 200 });
5074+
assertLabel({title: 'Feb 21, 2000', items: [
5075+
'bar : (Feb, 3)',
5076+
'scatter : 2.5'
5077+
]});
51455078

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);
5079+
_hover(gd, { xpx: 350, ypx: 200 });
5080+
assertLabel({title: 'Mar 6, 2000', items: [
5081+
'scatter : 3.2'
5082+
]});
5083+
})
5084+
.then(done, done.fail);
5085+
});
51525086
});
51535087

51545088
it('period points alignments', function(done) {

0 commit comments

Comments
 (0)