Skip to content

Commit e71b7df

Browse files
committed
assert multicategory event data
1 parent 3bc03e5 commit e71b7df

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/jasmine/tests/hover_label_test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,6 +2057,7 @@ describe('hover on fill', function() {
20572057

20582058
describe('Hover on multicategory axes', function() {
20592059
var gd;
2060+
var eventData;
20602061

20612062
beforeEach(function() {
20622063
gd = createGraphDiv();
@@ -2080,9 +2081,15 @@ describe('Hover on multicategory axes', function() {
20802081
width: 400,
20812082
height: 400
20822083
})
2084+
.then(function() {
2085+
gd.on('plotly_hover', function(d) {
2086+
eventData = d.points[0];
2087+
});
2088+
})
20832089
.then(function() { _hover(200, 200); })
20842090
.then(function() {
20852091
assertHoverLabelContent({ nums: '−1', axis: '2019 - a' });
2092+
expect(eventData.x).toEqual(['2019', 'a']);
20862093
})
20872094
.then(function() {
20882095
return Plotly.update(gd,
@@ -2093,6 +2100,7 @@ describe('Hover on multicategory axes', function() {
20932100
.then(function() { _hover(140, 200); })
20942101
.then(function() {
20952102
assertHoverLabelContent({ nums: 'Sample: b\nYear: 2018' });
2103+
expect(eventData.x).toEqual(['2018', 'b']);
20962104
})
20972105
.catch(failTest)
20982106
.then(done);
@@ -2105,11 +2113,17 @@ describe('Hover on multicategory axes', function() {
21052113
fig.layout.height = 500;
21062114

21072115
Plotly.plot(gd, fig)
2116+
.then(function() {
2117+
gd.on('plotly_hover', function(d) {
2118+
eventData = d.points[0];
2119+
});
2120+
})
21082121
.then(function() { _hover(200, 200); })
21092122
.then(function() {
21102123
assertHoverLabelContent({
21112124
nums: 'x: 2017 - q3\ny: Group 3 - A\nz: 2.303'
21122125
});
2126+
expect(eventData.x).toEqual(['2017', 'q3']);
21132127
})
21142128
.catch(failTest)
21152129
.then(done);

0 commit comments

Comments
 (0)