Skip to content

Commit 888a6ba

Browse files
committed
add jasmine tests for cartesian
1 parent c41b31d commit 888a6ba

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/jasmine/tests/cartesian_interact_test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2422,6 +2422,12 @@ describe('Cartesian plots with css transforms', function() {
24222422
}
24232423
};
24242424

2425+
var bbox = {
2426+
one: { x0: 20, x1: 180, y0: 273.33, y1: 273.33 },
2427+
two: { x0: 220, x1: 380, y0: 146.67, y1: 146.67 },
2428+
three: { x0: 420, x1: 580, y0: 20, y1: 20 }
2429+
};
2430+
24252431
[{
24262432
transform: 'scaleX(0.5)',
24272433
hovered: 1,
@@ -2436,12 +2442,14 @@ describe('Cartesian plots with css transforms', function() {
24362442
selected: {numPoints: 3, selectedLabels: ['one', 'two', 'three']}
24372443
}].forEach(function(t) {
24382444
var transform = t.transform;
2439-
24402445
it('hover behaves correctly after css transform: ' + transform, function(done) {
2446+
var _bboxRecordings = {};
2447+
24412448
function _hoverAndAssertEventOccurred(point, label) {
24422449
return _hover(point)
24432450
.then(function() {
24442451
expect(eventRecordings[label]).toBe(t.hovered);
2452+
expect(_bboxRecordings[label]).toEqual(bbox[label]);
24452453
})
24462454
.then(function() {
24472455
_unhover(point);
@@ -2454,6 +2462,7 @@ describe('Cartesian plots with css transforms', function() {
24542462

24552463
gd.on('plotly_hover', function(d) {
24562464
eventRecordings[d.points[0].x] = 1;
2465+
_bboxRecordings[d.points[0].x] = d.points[0].bbox;
24572466
});
24582467
})
24592468
.then(function() {_hoverAndAssertEventOccurred(points[0], xLabels[0]);})

0 commit comments

Comments
 (0)