| LEFT | RIGHT |
| 1 /* globals preparePrefs, restorePrefs, Prefs */ | |
| 2 | |
| 3 "use strict"; | 1 "use strict"; |
| 4 | 2 |
| 3 (function() |
| 5 { | 4 { |
| 5 const {Prefs} = require("prefs"); |
| 6 |
| 6 module("Preferences", { | 7 module("Preferences", { |
| 7 setup() | 8 setup() |
| 8 { | 9 { |
| 9 preparePrefs.call(this); | 10 this._pbackup = Object.create(null); |
| 11 for (let pref in Prefs) |
| 12 { |
| 13 let value = Prefs[pref]; |
| 14 this._pbackup[pref] = value; |
| 15 } |
| 16 Prefs.enabled = true; |
| 10 }, | 17 }, |
| 11 | 18 |
| 12 teardown() | 19 teardown() |
| 13 { | 20 { |
| 14 restorePrefs.call(this); | 21 for (let pref in this._pbackup) |
| 22 Prefs[pref] = this._pbackup[pref]; |
| 15 } | 23 } |
| 16 }); | 24 }); |
| 17 | 25 |
| 18 function checkPrefExists(name, expectedValue, description, assert) | 26 function checkPrefExists(name, expectedValue, description, assert) |
| 19 { | 27 { |
| 20 let done = assert.async(); | 28 let done = assert.async(); |
| 21 let key = "pref:" + name; | 29 let key = "pref:" + name; |
| 22 chrome.storage.local.get(key, items => | 30 chrome.storage.local.get(key, items => |
| 23 { | 31 { |
| 24 equal(key in items, expectedValue, description); | 32 equal(key in items, expectedValue, description); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 153 |
| 146 delete Prefs.notificationdata.foo; | 154 delete Prefs.notificationdata.foo; |
| 147 delete Prefs.notificationdata.bar; | 155 delete Prefs.notificationdata.bar; |
| 148 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata)); | 156 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata)); |
| 149 deepEqual( | 157 deepEqual( |
| 150 Prefs.notificationdata, {}, | 158 Prefs.notificationdata, {}, |
| 151 "Prefs object returns the correct value after setting pref to " + | 159 "Prefs object returns the correct value after setting pref to " + |
| 152 "default value" | 160 "default value" |
| 153 ); | 161 ); |
| 154 }); | 162 }); |
| 155 } | 163 }()); |
| LEFT | RIGHT |