Skip to content

Commit 4d378fb

Browse files
committed
Add a test to for custom hover format of epoch timestamp
Previously, the formatting of the epoch timestamp using custom a hover format did not work as expected (#6751). This patch adds a test to help prevent this issue reappearing in a regression. Signed-off-by: adamjhawley <[email protected]>
1 parent 1ef43ae commit 4d378fb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/jasmine/tests/hover_label_test.js

+15
Original file line numberDiff line numberDiff line change
@@ -4380,6 +4380,21 @@ describe('hover distance', function() {
43804380
})
43814381
.then(done, done.fail);
43824382
});
4383+
4384+
it('correctly format the epoch timestamp in a given hover format', function(done) {
4385+
var x = ['1970-01-01 00:00:00'];
4386+
var mock = {
4387+
data: [{type: 'scatter', x: x, y: [1]}],
4388+
layout: {width: 400, height: 400, xaxis: {hoverformat: '%H:%M:%S'}}
4389+
};
4390+
4391+
Plotly.newPlot(gd, mock)
4392+
.then(function(gd) {
4393+
Fx.hover(gd, {xpx: 120, ypx: 110});
4394+
assertHoverLabelContent({nums: '(00:00:00, 1)'});
4395+
})
4396+
.then(done, done.fail);
4397+
});
43834398
});
43844399
});
43854400

0 commit comments

Comments
 (0)