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

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

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Left Patch Set: "use strict"; Created Jan. 16, 2017, 3:30 a.m.
Right Patch Set: Addressed some more feedback Created Jan. 18, 2017, 11:44 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/cssEscaping.js ('k') | qunit/tests/prefs.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 "use strict"; 1 "use strict";
2 2
3 { 3 {
4 let filterValidation = require("filterValidation"); 4 const {parseFilter, parseFilters} = require("filterValidation");
5 let parseFilter = filterValidation.parseFilter; 5 const {BlockingFilter,
6 let parseFilters = filterValidation.parseFilters; 6 ElemHideFilter,
7 7 CommentFilter} = require("filterClasses");
8 let filterClasses = require("filterClasses");
9 let BlockingFilter = filterClasses.BlockingFilter;
10 let ElemHideFilter = filterClasses.ElemHideFilter;
11 let CommentFilter = filterClasses.CommentFilter;
12 8
13 module("Filter validation"); 9 module("Filter validation");
14 10
15 test("Detecting invalid filters", () => 11 test("Detecting invalid filters", () =>
16 { 12 {
17 equal(parseFilter("||example.com^$unknown").error.type, "invalid-filter", "u nknown option"); 13 equal(parseFilter("||example.com^$unknown").error.type, "invalid-filter", "u nknown option");
18 equal(parseFilter("[foobar]").error.type, "unexpected-filter-list-header", " filter list header"); 14 equal(parseFilter("[foobar]").error.type, "unexpected-filter-list-header", " filter list header");
19 equal(parseFilter("##[foo").error.type, "invalid-css-selector", "invalid sel ector"); 15 equal(parseFilter("##[foo").error.type, "invalid-css-selector", "invalid sel ector");
20 ok(/\b4\b/.test(parseFilters("!comment\r\n||example.com^\n\n##/").errors[0]) , "error contains corresponding line number"); 16 ok(/\b4\b/.test(parseFilters("!comment\r\n||example.com^\n\n##/").errors[0]) , "error contains corresponding line number");
21 }); 17 });
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ok(result.filters[0] instanceof BlockingFilter, "1st filter is blocking"); 56 ok(result.filters[0] instanceof BlockingFilter, "1st filter is blocking");
61 equal(result.filters[0].text, "||example.com^", "1st filter text matches"); 57 equal(result.filters[0].text, "||example.com^", "1st filter text matches");
62 58
63 ok(result.filters[1] instanceof ElemHideFilter, "2nd filter is elemhide"); 59 ok(result.filters[1] instanceof ElemHideFilter, "2nd filter is elemhide");
64 equal(result.filters[1].text, "###foobar", "2nd filter text matches"); 60 equal(result.filters[1].text, "###foobar", "2nd filter text matches");
65 61
66 ok(result.filters[2] instanceof CommentFilter, "3rd filter is comment"); 62 ok(result.filters[2] instanceof CommentFilter, "3rd filter is comment");
67 equal(result.filters[2].text, "! foo bar", "3rd filter text matches"); 63 equal(result.filters[2].text, "! foo bar", "3rd filter text matches");
68 }); 64 });
69 } 65 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld