Skip to content

Commit

Permalink
fixup mock and added jasmine test to lock hover on an interpolated su…
Browse files Browse the repository at this point in the history
…rface point
  • Loading branch information
archmoj committed Mar 20, 2019
1 parent f0ac268 commit afe36a6
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
Binary file modified test/image/baselines/gl3d_surface_connectgaps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions test/image/mocks/gl3d_surface_connectgaps.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
{
"type": "surface",
"connectgaps": true,
"x": [0, 1, 2, 3, 4],
"y": [0, 1, 2, 3],
"x": [0.1, 0.2, 0.3, 0.4],
"y": [0, 1, 2, 3, 4],
"z": [
[null, 2, 1, 1, 1],
[2, 1, null, 2, null],
[2, 1, 1, 1],
[1, null, 0, null]
[1001, 1002, 1001, null, null],
[1002, 1001, null, 1002, null],
[1002, null, 1001, 1001],
[null, null, 1000, null]
]
}
],
Expand Down
31 changes: 31 additions & 0 deletions test/jasmine/tests/gl3d_plot_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,37 @@ describe('Test gl3d plots', function() {
.then(done);
});

it('@gl should display correct hover labels and emit correct event data (surface case with connectgaps enabled)', function(done) {
var surfaceConnectgaps = require('@mocks/gl3d_surface_connectgaps');
var _mock = Lib.extendDeep({}, surfaceConnectgaps);

function _hover() {
mouseEvent('mouseover', 300, 200);
return delay(20)();
}

Plotly.plot(gd, _mock)
.then(delay(20))
.then(function() {
gd.on('plotly_hover', function(eventData) {
ptData = eventData.points[0];
});
})
.then(_hover)
.then(function() {
assertHoverText('x: 0.2', 'y: 2', 'z: 1,001.25');
assertEventData(0.2, 2, 1001.25, 0, [1, 2]);
assertHoverLabelStyle(d3.selectAll('g.hovertext'), {
bgcolor: 'rgb(68, 68, 68)',
bordercolor: 'rgb(255, 255, 255)',
fontSize: 13,
fontFamily: 'Arial',
fontColor: 'rgb(255, 255, 255)'
}, 'initial');
})
.then(done);
});

it('@gl should display correct hover labels and emit correct event data (surface case)', function(done) {
var _mock = Lib.extendDeep({}, mock3);

Expand Down

0 comments on commit afe36a6

Please sign in to comment.