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

Side by Side Diff: qunit/tests/prefs.js

Issue 29555663: Noissue - Fix prefs unit tests, account for a changed default value (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome
Patch Set: Created Sept. 25, 2017, 10:43 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }());
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld