Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: qunit/tests/prefs.js

Issue 29374674: Issue 4864 - Start using ESLint for adblockpluschrome (Closed)
Left Patch Set: Restored IIFEs and chrome/ext/common.js Created March 14, 2017, 8:01 a.m.
Right Patch Set: Use .includes again Created March 31, 2017, 8:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « qunit/tests/filterValidation.js ('k') | qunit/tests/url.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* globals preparePrefs, restorePrefs, Prefs */
2
3 "use strict"; 1 "use strict";
4 2
5 (function() 3 (function()
6 { 4 {
5 const {Prefs} = require("prefs");
6
7 module("Preferences", { 7 module("Preferences", {
8 setup() 8 setup()
9 { 9 {
10 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;
11 }, 17 },
12 18
13 teardown() 19 teardown()
14 { 20 {
15 restorePrefs.call(this); 21 for (let pref in this._pbackup)
22 Prefs[pref] = this._pbackup[pref];
16 } 23 }
17 }); 24 });
18 25
19 function checkPrefExists(name, expectedValue, description, assert) 26 function checkPrefExists(name, expectedValue, description, assert)
20 { 27 {
21 let done = assert.async(); 28 let done = assert.async();
22 let key = "pref:" + name; 29 let key = "pref:" + name;
23 chrome.storage.local.get(key, items => 30 chrome.storage.local.get(key, items =>
24 { 31 {
25 equal(key in items, expectedValue, description); 32 equal(key in items, expectedValue, description);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 delete Prefs.notificationdata.foo; 154 delete Prefs.notificationdata.foo;
148 delete Prefs.notificationdata.bar; 155 delete Prefs.notificationdata.bar;
149 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata)); 156 Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata));
150 deepEqual( 157 deepEqual(
151 Prefs.notificationdata, {}, 158 Prefs.notificationdata, {},
152 "Prefs object returns the correct value after setting pref to " + 159 "Prefs object returns the correct value after setting pref to " +
153 "default value" 160 "default value"
154 ); 161 );
155 }); 162 });
156 }()); 163 }());
LEFTRIGHT

Powered by Google App Engine
This is Rietveld