LEFT | RIGHT |
| 1 "use strict"; |
| 2 |
1 { | 3 { |
2 module("Preferences", | 4 module("Preferences", |
3 { | 5 { |
4 setup: function() | 6 setup() |
5 { | 7 { |
6 preparePrefs.call(this); | 8 preparePrefs.call(this); |
7 }, | 9 }, |
8 | 10 |
9 teardown: function() | 11 teardown() |
10 { | 12 { |
11 restorePrefs.call(this); | 13 restorePrefs.call(this); |
12 } | 14 } |
13 }); | 15 }); |
14 | 16 |
15 function checkPrefExists(name, expectedValue, description, assert) | 17 function checkPrefExists(name, expectedValue, description, assert) |
16 { | 18 { |
17 let done = assert.async(); | 19 let done = assert.async(); |
18 let key = "pref:" + name; | 20 let key = "pref:" + name; |
19 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... |
92 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"); |
93 checkPrefExists("notificationdata", true, "User-defined pref has been create
d", assert); | 95 checkPrefExists("notificationdata", true, "User-defined pref has been create
d", assert); |
94 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); |
95 | 97 |
96 delete Prefs.notificationdata.foo; | 98 delete Prefs.notificationdata.foo; |
97 delete Prefs.notificationdata.bar; | 99 delete Prefs.notificationdata.bar; |
98 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata)); | 100 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata)); |
99 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"); |
100 }); | 102 }); |
101 } | 103 } |
LEFT | RIGHT |