blob: 9d6da1d2db36834705a215017e4411dc5c7ce272 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
Cu.import("resource://services-sync/notifications.js");
function run_test() {
var logStats = initTestLogging("Info");
var blah = 0;
function callback(i) {
blah = i;
}
let button = new NotificationButton("label", "accessKey", callback);
button.callback(5);
do_check_eq(blah, 5);
do_check_eq(logStats.errorsLogged, 0);
function badCallback() {
throw new Error("oops");
}
button = new NotificationButton("label", "accessKey", badCallback);
try {
button.callback();
} catch (e) {
do_check_eq(e.message, "oops");
}
do_check_eq(logStats.errorsLogged, 1);
}
|