Skip to content

Commit 12a57c9

Browse files
committed
expand choroplethmapbox hover tests to cover css transform
1 parent 127f171 commit 12a57c9

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

test/jasmine/tests/choroplethmapbox_test.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,21 @@ describe('@noCI Test choroplethmapbox hover:', function() {
525525
setTimeout(done, 200);
526526
});
527527

528-
function run(s, done) {
528+
function transformPlot(gd, transformString) {
529+
gd.style.webkitTransform = transformString;
530+
gd.style.MozTransform = transformString;
531+
gd.style.msTransform = transformString;
532+
gd.style.OTransform = transformString;
533+
gd.style.transform = transformString;
534+
}
535+
536+
function run(hasCssTransform, s, done) {
529537
gd = createGraphDiv();
538+
var scale = 1;
539+
if(hasCssTransform) {
540+
scale = 0.5;
541+
transformPlot(gd, 'translate(-25%, -25%) scale(0.5)');
542+
}
530543

531544
var fig = Lib.extendDeep({},
532545
s.mock || require('@mocks/mapbox_choropleth0.json')
@@ -569,7 +582,7 @@ describe('@noCI Test choroplethmapbox hover:', function() {
569582
setTimeout(done, 0);
570583
});
571584

572-
mouseEvent('mousemove', pos[0], pos[1]);
585+
mouseEvent('mousemove', scale * pos[0], scale * pos[1]);
573586
})
574587
.catch(failTest);
575588
}
@@ -631,8 +644,10 @@ describe('@noCI Test choroplethmapbox hover:', function() {
631644
}];
632645

633646
specs.forEach(function(s) {
634-
it('@gl should generate correct hover labels ' + s.desc, function(done) {
635-
run(s, done);
647+
[false, true].forEach(function(hasCssTransform) {
648+
it('@gl should generate correct hover labels ' + s.desc + ', hasCssTransform: ' + hasCssTransform, function(done) {
649+
run(hasCssTransform, s, done);
650+
});
636651
});
637652
});
638653
});

0 commit comments

Comments
 (0)