toolkit/content/tests/chrome/test_bug509732.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/tests/chrome/test_bug509732.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     1.7 +<!--
     1.8 +  XUL Widget Test for bug 509732
     1.9 +  -->
    1.10 +<window title="Bug 509732" width="500" height="600"
    1.11 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.12 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>  
    1.13 +
    1.14 +    <notificationbox id="nb" hidden="true"/>
    1.15 +
    1.16 +  <!-- test results are displayed in the html:body -->
    1.17 +  <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"
    1.18 +        onload="test()"/>
    1.19 +
    1.20 +  <!-- test code goes here -->
    1.21 +<script type="application/javascript">
    1.22 +<![CDATA[
    1.23 +var gNotificationBox;
    1.24 +
    1.25 +// Tests that a notification that is added in an hidden box didn't throw the animation
    1.26 +function test() {
    1.27 +  SimpleTest.waitForExplicitFinish();
    1.28 +  gNotificationBox = document.getElementById("nb");
    1.29 +
    1.30 +  is(gNotificationBox.allNotifications.length, 0, "There should be no initial notifications");
    1.31 +
    1.32 +  gNotificationBox.appendNotification("Test notification",
    1.33 +                                      "notification1", null,
    1.34 +                                      gNotificationBox.PRIORITY_INFO_LOW,
    1.35 +                                      null);
    1.36 +
    1.37 +  is(gNotificationBox.allNotifications.length, 1, "Notification exists");
    1.38 +  is(gNotificationBox._animating, false, "Notification shouldn't be animating");
    1.39 +
    1.40 +  test1();
    1.41 +}
    1.42 +
    1.43 +// Tests that a notification that is removed from an hidden box didn't throw the animation
    1.44 +function test1() {
    1.45 +  let notification = gNotificationBox.getNotificationWithValue("notification1");
    1.46 +  gNotificationBox.removeNotification(notification);
    1.47 +  ok(!gNotificationBox.currentNotification, "Test 1 should show no current animation");
    1.48 +  is(gNotificationBox._animating, false, "Notification shouldn't be animating");
    1.49 +  is(gNotificationBox.allNotifications.length, 0, "Test 1 should show no notifications present");
    1.50 +
    1.51 +  SimpleTest.finish();
    1.52 +}
    1.53 +]]>
    1.54 +</script>
    1.55 +
    1.56 +</window>

mercurial