OLD | NEW |
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 (function() | 3 (function() |
4 { | 4 { |
5 const {Prefs} = require("prefs"); | 5 const {Prefs} = require("prefs"); |
6 | 6 |
7 module("Preferences", { | 7 module("Preferences", { |
8 setup() | 8 setup() |
9 { | 9 { |
10 this._pbackup = Object.create(null); | 10 this._pbackup = Object.create(null); |
(...skipping 29 matching lines...) Expand all Loading... |
40 let key = "pref:" + name; | 40 let key = "pref:" + name; |
41 chrome.storage.local.get(key, items => | 41 chrome.storage.local.get(key, items => |
42 { | 42 { |
43 deepEqual(items[key], expectedValue, description); | 43 deepEqual(items[key], expectedValue, description); |
44 done(); | 44 done(); |
45 }); | 45 }); |
46 } | 46 } |
47 | 47 |
48 test("Numerical pref", assert => | 48 test("Numerical pref", assert => |
49 { | 49 { |
50 Prefs.patternsbackups = 5; | 50 Prefs.patternsbackups = 0; |
51 equal( | 51 equal( |
52 Prefs.patternsbackups, 5, | 52 Prefs.patternsbackups, 0, |
53 "Prefs object returns the correct value after setting pref to " + | 53 "Prefs object returns the correct value after setting pref to " + |
54 "default value" | 54 "default value" |
55 ); | 55 ); |
56 checkPrefExists( | 56 checkPrefExists( |
57 "patternsbackups", false, "User-defined pref has been removed", assert | 57 "patternsbackups", false, "User-defined pref has been removed", assert |
58 ); | 58 ); |
59 Prefs.patternsbackups = 12; | 59 Prefs.patternsbackups = 12; |
60 equal( | 60 equal( |
61 Prefs.patternsbackups, 12, | 61 Prefs.patternsbackups, 12, |
62 "Prefs object returns the correct value after setting pref to " + | 62 "Prefs object returns the correct value after setting pref to " + |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 delete Prefs.notificationdata.foo; | 154 delete Prefs.notificationdata.foo; |
155 delete Prefs.notificationdata.bar; | 155 delete Prefs.notificationdata.bar; |
156 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata)); | 156 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata)); |
157 deepEqual( | 157 deepEqual( |
158 Prefs.notificationdata, {}, | 158 Prefs.notificationdata, {}, |
159 "Prefs object returns the correct value after setting pref to " + | 159 "Prefs object returns the correct value after setting pref to " + |
160 "default value" | 160 "default value" |
161 ); | 161 ); |
162 }); | 162 }); |
163 }()); | 163 }()); |
OLD | NEW |