Skip to content

Commit

Permalink
extend choropleth tests to include translate3d transform (plotly#5525)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaVazz committed Apr 22, 2021
1 parent 341963e commit c437006
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions test/jasmine/tests/choropleth_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ describe('Test choropleth hover:', function() {

function run(hasCssTransform, pos, fig, content, style) {
gd = createGraphDiv();
var scale = 1;

style = style || {
bgcolor: 'rgb(68, 68, 68)',
Expand All @@ -177,14 +176,8 @@ describe('Test choropleth hover:', function() {
fontFamily: 'Arial'
};

return Plotly.newPlot(gd, fig)
.then(function() {
if(hasCssTransform) {
scale = 0.5;
transformPlot(gd, 'translate(-25%, -25%) scale(0.5)');
}

mouseEvent('mousemove', scale * pos[0], scale * pos[1]);
function assertHoverLabel(posX, posY) {
mouseEvent('mousemove', posX, posY);
assertHoverLabelContent({
nums: content[0],
name: content[1]
Expand All @@ -193,6 +186,18 @@ describe('Test choropleth hover:', function() {
d3Select('g.hovertext'),
style
);
}

return Plotly.newPlot(gd, fig)
.then(function() {
if(hasCssTransform) {
transformPlot(gd, 'translate3d(10px, 10px, 0) scale(1)');
assertHoverLabel(pos[0] + 10, pos[1] + 10)
transformPlot(gd, 'translate(-25%, -25%) scale(0.5)');
assertHoverLabel(0.5 * pos[0], 0.5 * pos[1])
} else {
assertHoverLabel(pos[0], pos[1])
}
});
}

Expand Down

0 comments on commit c437006

Please sign in to comment.