Bug 1300784 - Follow-up: update browser_selectpopup.js to handle floating point values for bounding client rects. r?jaws
MozReview-Commit-ID: 5O2lmNOZHZD
--- a/browser/base/content/test/general/browser_selectpopup.js
+++ b/browser/base/content/test/general/browser_selectpopup.js
@@ -442,19 +442,24 @@ function* performLargePopupTests(win) {
ok(rect.top >= browserRect.top, "Popup top position in within browser area");
ok(rect.bottom <= browserRect.bottom, "Popup bottom position in within browser area");
// Don't check the scroll position for the last step as the popup will be cut off.
if (positions.length > 0) {
let cs = win.getComputedStyle(selectPopup);
let bpBottom = parseFloat(cs.paddingBottom) + parseFloat(cs.borderBottomWidth);
- is(selectPopup.childNodes[60].getBoundingClientRect().bottom,
- selectPopup.getBoundingClientRect().bottom - bpBottom,
- "Popup scroll at correct position " + bpBottom);
+ // Some of the styles applied to the menuitems are percentages, meaning
+ // that the final layout calculations returned by getBoundingClientRect()
+ // might return floating point values. We don't care about sub-pixel
+ // accuracy, and only care about the final pixel value, so we add a
+ // fuzz-factor of 1.
+ SimpleTest.isfuzzy(selectPopup.childNodes[60].getBoundingClientRect().bottom,
+ selectPopup.getBoundingClientRect().bottom - bpBottom,
+ 1, "Popup scroll at correct position " + bpBottom);
}
yield hideSelectPopup(selectPopup, "enter", win);
position = positions.shift();
if (!position) {
break;
}