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

Unified Diff: qunit/tests/prefs.js

Issue 29374674: Issue 4864 - Start using ESLint for adblockpluschrome (Closed)
Patch Set: Rebased Created March 17, 2017, 12:41 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « qunit/tests/filterValidation.js ('k') | qunit/tests/url.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: qunit/tests/prefs.js
diff --git a/qunit/tests/prefs.js b/qunit/tests/prefs.js
index 5430c8b2eb7ab123a1d9b84e41224c1bc8ac5629..3174ce1ca0845166abc8198f958a1c37a7d7273b 100644
--- a/qunit/tests/prefs.js
+++ b/qunit/tests/prefs.js
@@ -1,8 +1,12 @@
+/* globals preparePrefs, restorePrefs */
+
"use strict";
+(function()
{
- module("Preferences",
- {
+ const {Prefs} = require("prefs");
+
+ module("Preferences", {
setup()
{
preparePrefs.call(this);
@@ -39,22 +43,44 @@
test("Numerical pref", assert =>
{
Prefs.patternsbackups = 5;
- equal(Prefs.patternsbackups, 5, "Prefs object returns the correct value after setting pref to default value");
- checkPrefExists("patternsbackups", false, "User-defined pref has been removed", assert);
+ equal(
+ Prefs.patternsbackups, 5,
+ "Prefs object returns the correct value after setting pref to " +
+ "default value"
+ );
+ checkPrefExists(
+ "patternsbackups", false, "User-defined pref has been removed", assert
+ );
Prefs.patternsbackups = 12;
- equal(Prefs.patternsbackups, 12, "Prefs object returns the correct value after setting pref to non-default value");
- checkPrefExists("patternsbackups", true, "User-defined pref has been created", assert);
+ equal(
+ Prefs.patternsbackups, 12,
+ "Prefs object returns the correct value after setting pref to " +
+ "non-default value"
+ );
+ checkPrefExists(
+ "patternsbackups", true, "User-defined pref has been created", assert
+ );
checkPref("patternsbackups", 12, "Value has been written", assert);
});
test("Boolean pref", assert =>
{
Prefs.enabled = true;
- equal(Prefs.enabled, true, "Prefs object returns the correct value after setting pref to default value");
- checkPrefExists("enabled", false, "User-defined pref has been removed", assert);
+ equal(
+ Prefs.enabled, true,
+ "Prefs object returns the correct value after setting pref to " +
+ "default value"
+ );
+ checkPrefExists("enabled", false, "User-defined pref has been removed",
+ assert);
Prefs.enabled = false;
- equal(Prefs.enabled, false, "Prefs object returns the correct value after setting pref to non-default value");
- checkPrefExists("enabled", true, "User-defined pref has been created", assert);
+ equal(
+ Prefs.enabled, false,
+ "Prefs object returns the correct value after setting pref to " +
+ "non-default value"
+ );
+ checkPrefExists("enabled", true, "User-defined pref has been created",
+ assert);
checkPref("enabled", false, "Value has been written", assert);
});
@@ -62,25 +88,44 @@
{
let defaultValue = "https://notification.adblockplus.org/notification.json";
Prefs.notificationurl = defaultValue;
- equal(Prefs.notificationurl, defaultValue, "Prefs object returns the correct value after setting pref to default value");
- checkPrefExists("notificationurl", false, "User-defined pref has been removed", assert);
+ equal(
+ Prefs.notificationurl, defaultValue,
+ "Prefs object returns the correct value after setting pref to " +
+ "default value"
+ );
+ checkPrefExists("notificationurl", false,
+ "User-defined pref has been removed", assert);
let newValue = "https://notification.adblockplus.org/foo\u1234bar.json";
Prefs.notificationurl = newValue;
- equal(Prefs.notificationurl, newValue, "Prefs object returns the correct value after setting pref to non-default value");
- checkPrefExists("notificationurl", true, "User-defined pref has been created", assert);
+ equal(
+ Prefs.notificationurl, newValue,
+ "Prefs object returns the correct value after setting pref to " +
+ "non-default value"
+ );
+ checkPrefExists("notificationurl", true,
+ "User-defined pref has been created", assert);
checkPref("notificationurl", newValue, "Value has been written", assert);
});
test("Object pref (complete replacement)", assert =>
{
Prefs.notificationdata = {};
- deepEqual(Prefs.notificationdata, {}, "Prefs object returns the correct value after setting pref to default value");
+ deepEqual(
+ Prefs.notificationdata, {},
+ "Prefs object returns the correct value after setting pref to " +
+ "default value"
+ );
- let newValue = {foo:1, bar: "adsf\u1234"};
+ let newValue = {foo: 1, bar: "adsf\u1234"};
Prefs.notificationdata = newValue;
- equal(Prefs.notificationdata, newValue, "Prefs object returns the correct value after setting pref to non-default value");
- checkPrefExists("notificationdata", true, "User-defined pref has been created", assert);
+ equal(
+ Prefs.notificationdata, newValue,
+ "Prefs object returns the correct value after setting pref to " +
+ "non-default value"
+ );
+ checkPrefExists("notificationdata", true,
+ "User-defined pref has been created", assert);
checkPref("notificationdata", newValue, "Value has been written", assert);
});
@@ -91,13 +136,23 @@
Prefs.notificationdata.foo = 1;
Prefs.notificationdata.bar = 2;
Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata));
- deepEqual(Prefs.notificationdata, {foo:1, bar: 2}, "Prefs object returns the correct value after setting pref to non-default value");
- checkPrefExists("notificationdata", true, "User-defined pref has been created", assert);
- checkPref("notificationdata", {foo:1, bar: 2}, "Value has been written", assert);
+ deepEqual(
+ Prefs.notificationdata, {foo: 1, bar: 2},
+ "Prefs object returns the correct value after setting pref to " +
+ "non-default value"
+ );
+ checkPrefExists("notificationdata", true,
+ "User-defined pref has been created", assert);
+ checkPref("notificationdata", {foo: 1, bar: 2}, "Value has been written",
+ assert);
delete Prefs.notificationdata.foo;
delete Prefs.notificationdata.bar;
Prefs.notificationdata = JSON.parse(JSON.stringify(Prefs.notificationdata));
- deepEqual(Prefs.notificationdata, {}, "Prefs object returns the correct value after setting pref to default value");
+ deepEqual(
+ Prefs.notificationdata, {},
+ "Prefs object returns the correct value after setting pref to " +
+ "default value"
+ );
});
-}
+}());
« no previous file with comments | « qunit/tests/filterValidation.js ('k') | qunit/tests/url.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld