test_bug477754.xul 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?xml version="1.0"?>
  2. <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
  3. <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
  4. <!--
  5. https://bugzilla.mozilla.org/show_bug.cgi?id=477754
  6. -->
  7. <window title="Mozilla Bug 477754"
  8. xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  9. <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
  10. <!-- test results are displayed in the html:body -->
  11. <body xmlns="http://www.w3.org/1999/xhtml">
  12. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=477754"
  13. target="_blank">Mozilla Bug 477754</a>
  14. </body>
  15. <hbox pack="center">
  16. <label id="anchor" style="direction: rtl;" value="Anchor"/>
  17. </hbox>
  18. <panel id="testPopup" onpopupshown="doTest();">
  19. <label value="I am a popup"/>
  20. </panel>
  21. <!-- test code goes here -->
  22. <script type="application/javascript"><![CDATA[
  23. /** Test for Bug 477754 **/
  24. SimpleTest.waitForExplicitFinish();
  25. let testPopup, testAnchor;
  26. addEventListener("load", function () {
  27. removeEventListener("load", arguments.callee, false);
  28. testPopup = document.getElementById("testPopup");
  29. testAnchor = document.getElementById("anchor");
  30. testPopup.openPopup(testAnchor, "after_start", 10, 0, false, false);
  31. }, false);
  32. function doTest() {
  33. is(Math.round(testAnchor.getBoundingClientRect().right -
  34. testPopup.getBoundingClientRect().right), 10,
  35. "RTL popup's right offset should be equal to the x offset passed to openPopup");
  36. testPopup.hidePopup();
  37. SimpleTest.finish();
  38. }
  39. ]]></script>
  40. </window>