/toolkit/content/tests/chrome/test_bug509732.xul

http://github.com/zpao/v8monkey · Unknown · 53 lines · 42 code · 11 blank · 0 comment · 0 complexity · 38991f4a4b91035dba4dd66d3a7e34d9 MD5 · raw file

  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. XUL Widget Test for bug 509732
  6. -->
  7. <window title="Bug 509732" width="500" height="600"
  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"></script>
  10. <notificationbox id="nb" hidden="true"/>
  11. <!-- test results are displayed in the html:body -->
  12. <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"
  13. onload="test()"/>
  14. <!-- test code goes here -->
  15. <script type="application/javascript">
  16. <![CDATA[
  17. var gNotificationBox;
  18. // Tests that a notification that is added in an hidden box didn't throw the animation
  19. function test() {
  20. SimpleTest.waitForExplicitFinish();
  21. gNotificationBox = document.getElementById("nb");
  22. is(gNotificationBox.allNotifications.length, 0, "There should be no initial notifications");
  23. gNotificationBox.appendNotification("Test notification",
  24. "notification1", null,
  25. gNotificationBox.PRIORITY_INFO_LOW,
  26. null);
  27. is(gNotificationBox.allNotifications.length, 1, "Notification exists");
  28. is(gNotificationBox._animating, false, "Notification shouldn't be animating");
  29. test1();
  30. }
  31. // Tests that a notification that is removed from an hidden box didn't throw the animation
  32. function test1() {
  33. let notification = gNotificationBox.getNotificationWithValue("notification1");
  34. gNotificationBox.removeNotification(notification);
  35. ok(!gNotificationBox.currentNotification, "Test 1 should show no current animation");
  36. is(gNotificationBox._animating, false, "Notification shouldn't be animating");
  37. is(gNotificationBox.allNotifications.length, 0, "Test 1 should show no notifications present");
  38. SimpleTest.finish();
  39. }
  40. ]]>
  41. </script>
  42. </window>