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

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

Issue 29713631: Issue 5760 - Use relative require paths (Closed)
Left Patch Set: Created March 3, 2018, 4:09 a.m.
Right Patch Set: Address PS4 comments, rebase Created April 5, 2018, 11:09 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
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
(no file at all)
1 "use strict"; 1 "use strict";
2 2
3 { 3 {
4 const {parseFilter, parseFilters} = require("filterValidation"); 4 const {parseFilter, parseFilters} = require("../../lib/filterValidation");
5 const {BlockingFilter, 5 const {BlockingFilter,
6 ElemHideFilter, 6 ElemHideFilter,
7 CommentFilter} = require("filterClasses"); 7 CommentFilter} = require("../../adblockpluscore/lib/filterClasses");
8 8
9 QUnit.module("Filter validation"); 9 QUnit.module("Filter validation");
10 10
11 test("Detecting invalid filters", () => 11 test("Detecting invalid filters", () =>
12 { 12 {
13 equal(parseFilter("||example.com^$unknown").error.type, "invalid-filter", 13 equal(parseFilter("||example.com^$unknown").error.type, "invalid-filter",
14 "unknown option"); 14 "unknown option");
15 equal(parseFilter("[foobar]").error.type, "unexpected-filter-list-header", 15 equal(parseFilter("[foobar]").error.type, "unexpected-filter-list-header",
16 "filter list header"); 16 "filter list header");
17 equal(parseFilter("##[foo").error.type, "invalid-css-selector", 17 equal(parseFilter("##[foo").error.type, "invalid-css-selector",
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 ok(result.filters[0] instanceof BlockingFilter, "1st filter is blocking"); 64 ok(result.filters[0] instanceof BlockingFilter, "1st filter is blocking");
65 equal(result.filters[0].text, "||example.com^", "1st filter text matches"); 65 equal(result.filters[0].text, "||example.com^", "1st filter text matches");
66 66
67 ok(result.filters[1] instanceof ElemHideFilter, "2nd filter is elemhide"); 67 ok(result.filters[1] instanceof ElemHideFilter, "2nd filter is elemhide");
68 equal(result.filters[1].text, "###foobar", "2nd filter text matches"); 68 equal(result.filters[1].text, "###foobar", "2nd filter text matches");
69 69
70 ok(result.filters[2] instanceof CommentFilter, "3rd filter is comment"); 70 ok(result.filters[2] instanceof CommentFilter, "3rd filter is comment");
71 equal(result.filters[2].text, "! foo bar", "3rd filter text matches"); 71 equal(result.filters[2].text, "! foo bar", "3rd filter text matches");
72 }); 72 });
73 } 73 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld