PageRenderTime 16ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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