LEFT | RIGHT |
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 { | 3 { |
4 module("Preferences", | 4 module("Preferences", |
5 { | 5 { |
6 setup: function() | 6 setup() |
7 { | 7 { |
8 preparePrefs.call(this); | 8 preparePrefs.call(this); |
9 }, | 9 }, |
10 | 10 |
11 teardown: function() | 11 teardown() |
12 { | 12 { |
13 restorePrefs.call(this); | 13 restorePrefs.call(this); |
14 } | 14 } |
15 }); | 15 }); |
16 | 16 |
17 function checkPrefExists(name, expectedValue, description, assert) | 17 function checkPrefExists(name, expectedValue, description, assert) |
18 { | 18 { |
19 let done = assert.async(); | 19 let done = assert.async(); |
20 let key = "pref:" + name; | 20 let key = "pref:" + name; |
21 chrome.storage.local.get(key, items => | 21 chrome.storage.local.get(key, items => |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 deepEqual(Prefs.notificationdata, {foo:1, bar: 2}, "Prefs object returns the
correct value after setting pref to non-default value"); | 94 deepEqual(Prefs.notificationdata, {foo:1, bar: 2}, "Prefs object returns the
correct value after setting pref to non-default value"); |
95 checkPrefExists("notificationdata", true, "User-defined pref has been create
d", assert); | 95 checkPrefExists("notificationdata", true, "User-defined pref has been create
d", assert); |
96 checkPref("notificationdata", {foo:1, bar: 2}, "Value has been written", ass
ert); | 96 checkPref("notificationdata", {foo:1, bar: 2}, "Value has been written", ass
ert); |
97 | 97 |
98 delete Prefs.notificationdata.foo; | 98 delete Prefs.notificationdata.foo; |
99 delete Prefs.notificationdata.bar; | 99 delete Prefs.notificationdata.bar; |
100 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata)); | 100 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata)); |
101 deepEqual(Prefs.notificationdata, {}, "Prefs object returns the correct valu
e after setting pref to default value"); | 101 deepEqual(Prefs.notificationdata, {}, "Prefs object returns the correct valu
e after setting pref to default value"); |
102 }); | 102 }); |
103 } | 103 } |
LEFT | RIGHT |