Skip to content

Commit 04bf731

Browse files
committed
add hover test for xyz heatmap trace
1 parent b98f0fe commit 04bf731

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test/jasmine/tests/heatmap_test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,4 +589,38 @@ describe('heatmap hover', function() {
589589
});
590590
});
591591

592+
describe('for xyz-column traces', function() {
593+
594+
beforeAll(function(done) {
595+
gd = createGraphDiv();
596+
597+
Plotly.plot(gd, [{
598+
type: 'heatmap',
599+
x: [1, 2, 3],
600+
y: [1, 1, 1],
601+
z: [10, 4, 20],
602+
text: ['a', 'b', 'c'],
603+
hoverinfo: 'text'
604+
}])
605+
.then(done);
606+
});
607+
608+
afterAll(destroyGraphDiv);
609+
610+
it('should find closest point and should', function(done) {
611+
var pt = _hover(gd, 0.5, 0.5)[0];
612+
613+
expect(pt.index).toEqual([0, 0], 'have correct index');
614+
assertLabels(pt, 1, 1, 10, 'a');
615+
616+
Plotly.relayout(gd, 'xaxis.range', [1, 2]).then(function() {
617+
var pt2 = _hover(gd, 1.5, 0.5)[0];
618+
619+
expect(pt2.index).toEqual([0, 1], 'have correct index');
620+
assertLabels(pt2, 2, 1, 4, 'b');
621+
})
622+
.then(done);
623+
});
624+
625+
});
592626
});

0 commit comments

Comments
 (0)