Skip to content

Commit

Permalink
Chrome on retina Mac seems to use a pixel less
Browse files Browse the repository at this point in the history
  • Loading branch information
krosenvold committed Jul 8, 2015
1 parent 2051f9a commit eda96a0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions javascript/atoms/test/scrolling_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@

bot.action.scrollIntoView(element);

expectedFailures.expectFailureFor(goog.userAgent.product.ANDROID &&
expectedFailures.expectFailureFor(goog.userAgent.product.ANDROID &&
!bot.userAgent.isProductVersion(4.1),
'Android pre-Jellybean doesn\'t provide scrolling information');
expectedFailures.run(function() {
Expand Down Expand Up @@ -209,6 +209,10 @@
bot.action.scrollIntoView(elem, new goog.math.Coordinate(75, 75));
var rectAfter = bot.dom.getClientRect(elem);

// Seems like chrome on MacOs is stealing a pixel
var expected = goog.labs.userAgent.browser.isChrome() && goog.labs.userAgent.platform.isMacintosh() ?
25 : 26;

// If the scrollbar isn't taken into account, the minimum scrolling
// needed would be 26 pixels, to bring the full pixel into view.
// This should fail on mobile and tablet since the scrollbars aren't shown.
Expand All @@ -218,8 +222,8 @@
goog.labs.userAgent.device.isMobile() || goog.labs.userAgent.device.isTablet() ||
(goog.userAgent.IE && !goog.userAgent.isVersion(7)));
expectedFailures.run(function() {
assertTrue('horizontal scroll did not account for scrollbar',
rectBefore.left - rectAfter.left > 26);
assertTrue('horizontal scroll did not account for scrollbar' + (rectBefore.left - rectAfter.left),
rectBefore.left - rectAfter.left > expected);
assertTrue('vertical scroll did not account for scrollbar',
rectBefore.top - rectAfter.top > 26);
});
Expand Down

0 comments on commit eda96a0

Please sign in to comment.