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

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

Issue 29713631: Issue 5760 - Use relative require paths (Closed)
Patch Set: Address PS3 comment Created April 3, 2018, 6:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 "use strict"; 1 "use strict";
2 2
3 { 3 {
4 const {parseFilter, parseFilters} = require("filterValidation"); 4 const {parseFilter, parseFilters} = require("filterValidation");
kzar 2018/04/05 11:14:57 What about this one?
Jon Sonesen 2018/04/05 23:01:20 Since this file is names filterValidation as well,
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld