Bug 1738265 - Trivially fix other two popup tests that I had missed. r=stransky

Differential Revision: https://phabricator.services.mozilla.com/D129963
This commit is contained in:
Emilio Cobos Álvarez 2021-10-30 11:25:04 +00:00
Родитель 21d001f4a5
Коммит 787ae7b8dd
2 изменённых файлов: 12 добавлений и 11 удалений

Просмотреть файл

@ -7,12 +7,10 @@
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
</body>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
<script><![CDATA[
SimpleTest.waitForExplicitFinish();
function openPopup()
@ -23,12 +21,15 @@
function popupShown(event)
{
document.getElementById("parent").className = "";
var popup = document.getElementById("thepopup");
var buttonbcr = document.getElementById("thebutton").getBoundingClientRect();
var popupbcr = document.getElementById("thepopup").getOuterScreenRect();
var popupbcr = popup.getOuterScreenRect();
var popupMarginLeft = parseFloat(getComputedStyle(popup).marginLeft);
var popupMarginTop = parseFloat(getComputedStyle(popup).marginLeft);
ok(Math.abs(popupbcr.x - window.mozInnerScreenX - buttonbcr.x) < 3, "x pos is correct");
ok(Math.abs(popupbcr.y - window.mozInnerScreenY - buttonbcr.bottom) < 3, "y pos is correct");
ok(Math.abs(popupbcr.x - popupMarginLeft - window.mozInnerScreenX - buttonbcr.x) < 3, "x pos is correct");
ok(Math.abs(popupbcr.y - popupMarginTop - window.mozInnerScreenY - buttonbcr.bottom) < 3, "y pos is correct");
event.target.hidePopup();
}

Просмотреть файл

@ -6,12 +6,10 @@
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
</body>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
<script><![CDATA[
SimpleTest.waitForExplicitFinish();
var savedzoom;
@ -29,11 +27,13 @@
function popupShown(event)
{
var panel = document.getElementById("panel");
var panelMarginLeft = parseFloat(getComputedStyle(panel).marginLeft);
var panelMarginTop = parseFloat(getComputedStyle(panel).marginLeft);
var panelbcr = panel.getBoundingClientRect();
var anchorbcr = document.getElementById("anchor").getBoundingClientRect();
ok(Math.abs(panelbcr.x - anchorbcr.x) < 3, "x pos is correct");
ok(Math.abs(panelbcr.y - anchorbcr.bottom) < 3, "y pos is correct");
ok(Math.abs(panelbcr.x - panelMarginLeft - anchorbcr.x) < 3, "x pos is correct");
ok(Math.abs(panelbcr.y - panelMarginTop - anchorbcr.bottom) < 3, "y pos is correct");
SpecialPowers.setFullZoom(window, savedzoom);