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

Unified Diff: qunit/tests/filterValidation.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: "use strict"; Created Jan. 16, 2017, 3:30 a.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/cssEscaping.js ('k') | qunit/tests/prefs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: qunit/tests/filterValidation.js
diff --git a/qunit/tests/filterValidation.js b/qunit/tests/filterValidation.js
index 38b96ea8267638248e842696e26b7345f669d258..556e6700323860c4c0ef368e9934a36e0761ff68 100644
--- a/qunit/tests/filterValidation.js
+++ b/qunit/tests/filterValidation.js
@@ -1,17 +1,18 @@
-(function()
+"use strict";
+
{
- var filterValidation = require("filterValidation");
- var parseFilter = filterValidation.parseFilter;
- var parseFilters = filterValidation.parseFilters;
+ let filterValidation = require("filterValidation");
+ let parseFilter = filterValidation.parseFilter;
+ let parseFilters = filterValidation.parseFilters;
- var filterClasses = require("filterClasses");
- var BlockingFilter = filterClasses.BlockingFilter;
- var ElemHideFilter = filterClasses.ElemHideFilter;
- var CommentFilter = filterClasses.CommentFilter;
+ let filterClasses = require("filterClasses");
+ let BlockingFilter = filterClasses.BlockingFilter;
+ let ElemHideFilter = filterClasses.ElemHideFilter;
+ let CommentFilter = filterClasses.CommentFilter;
module("Filter validation");
- test("Detecting invalid filters", function()
+ test("Detecting invalid filters", () =>
{
equal(parseFilter("||example.com^$unknown").error.type, "invalid-filter", "unknown option");
equal(parseFilter("[foobar]").error.type, "unexpected-filter-list-header", "filter list header");
@@ -19,9 +20,9 @@
ok(/\b4\b/.test(parseFilters("!comment\r\n||example.com^\n\n##/").errors[0]), "error contains corresponding line number");
});
- test("Allowing valid filters", function()
+ test("Allowing valid filters", () =>
{
- var text, filter;
+ let text, filter;
text = "||example.com^";
filter = parseFilter(text).filter;
@@ -41,17 +42,17 @@
equal(parseFilter("").filter, null, "empty filter parsed as 'null'");
});
- test("Normalizing filters", function()
+ test("Normalizing filters", () =>
{
- var ws = " \t\r\n";
+ let ws = " \t\r\n";
equal(parseFilter(ws + "@@" + ws + "||" + ws + "example.com" + ws + "^" + ws).filter.text, "@@||example.com^", "unnecessary spaces");
equal(parseFilter(ws).filter, null, "only spaces");
});
- test("Parsing multiple filters", function()
+ test("Parsing multiple filters", () =>
{
- var result = parseFilters("||example.com^\n \n###foobar\r\n! foo bar\n");
+ let result = parseFilters("||example.com^\n \n###foobar\r\n! foo bar\n");
equal(result.errors.length, 0, "no error occurred");
equal(result.filters.length, 3, "all filters parsed");
@@ -65,4 +66,4 @@
ok(result.filters[2] instanceof CommentFilter, "3rd filter is comment");
equal(result.filters[2].text, "! foo bar", "3rd filter text matches");
});
-})();
+}
« no previous file with comments | « qunit/tests/cssEscaping.js ('k') | qunit/tests/prefs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld