Bug 419514: fix typo in notificationbox 'persistence' getter, r=enndeakin, a=damon
authorgavin@gavinsharp.com
Tue, 26 Feb 2008 15:45:02 -0800
changeset 12292 672a30cfdd9ed7656ecb9e0da8dec9a9b1cc8669
parent 12291 23c108f5d84848ef2089cb0656a3e5572e3bff03
child 12293 e5967953a55e90e4a358c3f089cecabc951a7621
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin, damon
bugs419514
milestone1.9b4pre
Bug 419514: fix typo in notificationbox 'persistence' getter, r=enndeakin, a=damon
toolkit/content/tests/widgets/test_notificationbox.xul
toolkit/content/widgets/notification.xml
--- a/toolkit/content/tests/widgets/test_notificationbox.xul
+++ b/toolkit/content/tests/widgets/test_notificationbox.xul
@@ -82,16 +82,66 @@ var tests =
 
       // try removing the notification again to make sure an exception occurs
       var exh = false;
       try {
         nb.removeNotification(ntf);
       } catch (ex) { exh = true; }
       ise(exh, true, "removeNotification again");
       testtag_notificationbox_State(nb, "removeNotification again", null, 0);
+
+      return [1, null];
+    }
+  },
+  {
+    repeat: true,
+    test: function(nb, arr) {
+      var idx = arr[0];
+      var ntf = arr[1];
+      switch (idx) {
+        case 1:
+          // append a new notification
+          ntf = nb.appendNotification("Notification", "note", "happy.png",
+                            nb.PRIORITY_INFO_LOW, testtag_notificationbox_buttons);
+          ise(ntf && ntf.localName == "notification", true, "append notification");
+
+          // Test persistence
+          ntf.persistence++;
+
+          return [idx, ntf];
+        case 2:
+        case 3:
+          nb.removeTransientNotifications();
+
+          return [idx, ntf];
+      }
+    },
+    result: function(nb, arr) {
+      var idx = arr[0];
+      var ntf = arr[1];
+      switch (idx) {
+        case 1:
+          testtag_notificationbox_State(nb, "notification added", ntf, 1);
+          testtag_notification_State(nb, ntf, "append", "Notification", "note",
+                                     "happy.png", nb.PRIORITY_INFO_LOW);
+          ise(ntf.persistence, 1, "persistence is 1");
+
+          return [++idx, ntf];
+        case 2:
+          testtag_notificationbox_State(nb, "first removeTransientNotifications", ntf, 1);
+          testtag_notification_State(nb, ntf, "append", "Notification", "note",
+                                     "happy.png", nb.PRIORITY_INFO_LOW);
+          ise(ntf.persistence, 0, "persistence is now 0");
+
+          return [++idx, ntf];
+        case 3:
+          testtag_notificationbox_State(nb, "second removeTransientNotifications", null, 0);
+          
+          this.repeat = false;
+      }
     }
   },
   {
     test: function(nb, ntf) {
       // append another notification
       var ntf = nb.appendNotification("Notification", "note", "happy.png",
                                       nb.PRIORITY_INFO_MEDIUM, testtag_notificationbox_buttons);
       ise(ntf && ntf.localName == "notification", true, "append notification again");
@@ -196,17 +246,17 @@ var tests =
       try {
         nb.appendNotification("no", "no", "no", 11, null);
       } catch (ex) { exh = true; }
       ise(exh, true, "appendNotification priority too high");
 
       // check that the other priority types work properly
       runTimedTests(appendPriorityTests, -1, nb, nb.PRIORITY_WARNING_LOW);
     }
-  },
+  }
 ];
 
 var appendPriorityTests = [
   {
     test: function(nb, priority) {
       var ntf = nb.appendNotification("Notification", "note", "happy.png",
                                       priority, testtag_notificationbox_buttons);
       ise(ntf && ntf.localName == "notification", true, "append notification " + priority);
--- a/toolkit/content/widgets/notification.xml
+++ b/toolkit/content/widgets/notification.xml
@@ -357,17 +357,17 @@
       <property name="value" onset="this.setAttribute('value', val); return val;"
                              onget="return this.getAttribute('value');"/>
       <property name="image" onset="this.setAttribute('image', val); return val;"
                              onget="return this.getAttribute('image');"/>
       <property name="type" onset="this.setAttribute('type', val); return val;"
                             onget="return this.getAttribute('type');"/>
       <property name="priority" onget="return parseInt(this.getAttribute('priority')) || 0;"
                                 onset="this.setAttribute('priority', val); return val;"/>
-      <property name="persistence" onget="return parseInt(this.getAttribute('persistance')) || 0;"
+      <property name="persistence" onget="return parseInt(this.getAttribute('persistence')) || 0;"
                                    onset="this.setAttribute('persistence', val); return val;"/>
       <field name="timeout">0</field>
 
       <property name="control" readonly="true">
         <getter>
           <![CDATA[
             var parent = this.parentNode;
             while (parent) {