/toolkit/content/tests/chrome/test_bug649840.xul

http://github.com/zpao/v8monkey · Unknown · 66 lines · 52 code · 14 blank · 0 comment · 0 complexity · a36cf52732001ee1f2cee4c78900aa9b MD5 · raw file

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
  3. <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
  4. <!--
  5. https://bugzilla.mozilla.org/show_bug.cgi?id=649840
  6. -->
  7. <window title="Mozilla Bug 649840"
  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. <textbox id="textLTR" type="autocomplete" autocompletesearch="simple"/>
  11. <textbox id="textRTL" type="autocomplete" autocompletesearch="simple"/>
  12. <!-- test results are displayed in the html:body -->
  13. <body xmlns="http://www.w3.org/1999/xhtml">
  14. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=649840"
  15. target="_blank">Mozilla Bug 649840</a>
  16. </body>
  17. <!-- test code goes here -->
  18. <script type="application/javascript">
  19. <![CDATA[
  20. /** Test for Bug 649840 **/
  21. SimpleTest.waitForExplicitFinish();
  22. addLoadEvent(runTest);
  23. function runTest()
  24. {
  25. var textLTR = $("textLTR");
  26. var textRTL = $("textRTL");
  27. textLTR.style.direction = "ltr";
  28. textRTL.style.direction = "rtl";
  29. textLTR.value="abcd";
  30. textRTL.value="????";
  31. // open and close the popups to update the popupdir attribute value
  32. textLTR.openPopup();
  33. textLTR.closePopup();
  34. textRTL.openPopup();
  35. textRTL.closePopup();
  36. is(textLTR.popup.style.direction, textLTR.style.direction, "LTR textbox test fails");
  37. is(textRTL.popup.style.direction, textRTL.style.direction, "RTL textbox test fails");
  38. // switch directions of the two textboxes
  39. textLTR.style.direction = "rtl";
  40. textRTL.style.direction = "ltr";
  41. // open and close the popups to update the popupdir attribute value
  42. textLTR.openPopup();
  43. textLTR.closePopup();
  44. textRTL.openPopup();
  45. textRTL.closePopup();
  46. is(textLTR.popup.style.direction, textLTR.style.direction, "RTL-switched textbox test fails");
  47. is(textRTL.popup.style.direction, textRTL.style.direction, "LTR-switched textbox test fails");
  48. SimpleTest.finish();
  49. }
  50. ]]>
  51. </script>
  52. </window>