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

Side by Side Diff: test/matcher.js

Issue 29965585: Issue 6992 - Try all keyword candidates when removing a filter (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Dec. 19, 2018, 5:56 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
« no previous file with comments | « lib/matcher.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 test.ok(!matcher.isWhitelisted("https://example.com/foo", 285 test.ok(!matcher.isWhitelisted("https://example.com/foo",
286 RegExpFilter.typeMap.IMAGE)); 286 RegExpFilter.typeMap.IMAGE));
287 test.ok(!matcher.isWhitelisted("https://example.com/bar", 287 test.ok(!matcher.isWhitelisted("https://example.com/bar",
288 RegExpFilter.typeMap.IMAGE)); 288 RegExpFilter.typeMap.IMAGE));
289 test.ok(!matcher.isWhitelisted("https://example.com/foo", 289 test.ok(!matcher.isWhitelisted("https://example.com/foo",
290 RegExpFilter.typeMap.SUBDOCUMENT)); 290 RegExpFilter.typeMap.SUBDOCUMENT));
291 291
292 test.done(); 292 test.done();
293 }; 293 };
294
295 exports.testAddRemove = function(test)
296 {
297 let matcher = new CombinedMatcher();
298
299 matcher.add(Filter.fromText("||example.com/foo/bar/image.jpg"));
300
301 test.ok(!!matcher.matchesAny("https://example.com/foo/bar/image.jpg",
302 RegExpFilter.typeMap.IMAGE));
303
304 matcher.remove(Filter.fromText("||example.com/foo/bar/image.jpg"));
305
306 test.ok(!matcher.matchesAny("https://example.com/foo/bar/image.jpg",
307 RegExpFilter.typeMap.IMAGE));
308
309 test.done();
310 };
OLDNEW
« no previous file with comments | « lib/matcher.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld