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

Side by Side Diff: test/filterStorage.js

Issue 29453590: Issue 5287 - Change syntax for element hiding emulation filters and remove simplified element hidin… (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created June 1, 2017, 12:01 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
« test/filterClasses.js ('K') | « test/filterListener.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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 FilterStorage.addFilter(Filter.fromText("foo")); 233 FilterStorage.addFilter(Filter.fromText("foo"));
234 compareFiltersList(test, "Adding blocking filter", [["foo"], [], []]); 234 compareFiltersList(test, "Adding blocking filter", [["foo"], [], []]);
235 test.deepEqual(changes, ["filter.added foo"], "Received changes"); 235 test.deepEqual(changes, ["filter.added foo"], "Received changes");
236 236
237 changes = []; 237 changes = [];
238 FilterStorage.addFilter(Filter.fromText("@@bar")); 238 FilterStorage.addFilter(Filter.fromText("@@bar"));
239 compareFiltersList(test, "Adding exception rule", [["foo"], ["@@bar"], []]); 239 compareFiltersList(test, "Adding exception rule", [["foo"], ["@@bar"], []]);
240 test.deepEqual(changes, ["filter.added @@bar"], "Received changes"); 240 test.deepEqual(changes, ["filter.added @@bar"], "Received changes");
241 241
242 changes = []; 242 changes = [];
243 FilterStorage.addFilter(Filter.fromText("foo#bar")); 243 FilterStorage.addFilter(Filter.fromText("foo##bar"));
244 compareFiltersList(test, "Adding hiding rule", [["foo"], ["@@bar", "foo#bar"], []]); 244 compareFiltersList(test, "Adding hiding rule", [["foo"], ["@@bar", "foo##bar"] , []]);
245 test.deepEqual(changes, ["filter.added foo#bar"], "Received changes"); 245 test.deepEqual(changes, ["filter.added foo##bar"], "Received changes");
246 246
247 changes = []; 247 changes = [];
248 FilterStorage.addFilter(Filter.fromText("foo#@#bar")); 248 FilterStorage.addFilter(Filter.fromText("foo#@#bar"));
249 compareFiltersList(test, "Adding hiding exception", [["foo"], ["@@bar", "foo#b ar", "foo#@#bar"], []]); 249 compareFiltersList(test, "Adding hiding exception", [["foo"], ["@@bar", "foo## bar", "foo#@#bar"], []]);
250 test.deepEqual(changes, ["filter.added foo#@#bar"], "Received changes"); 250 test.deepEqual(changes, ["filter.added foo#@#bar"], "Received changes");
251 251
252 changes = []; 252 changes = [];
253 FilterStorage.addFilter(Filter.fromText("!foobar")); 253 FilterStorage.addFilter(Filter.fromText("!foobar"));
254 compareFiltersList(test, "Adding comment", [["foo"], ["@@bar", "foo#bar", "foo #@#bar"], ["!foobar"]]); 254 compareFiltersList(test, "Adding comment", [["foo"], ["@@bar", "foo##bar", "fo o#@#bar"], ["!foobar"]]);
255 test.deepEqual(changes, ["filter.added !foobar"], "Received changes"); 255 test.deepEqual(changes, ["filter.added !foobar"], "Received changes");
256 256
257 changes = []; 257 changes = [];
258 FilterStorage.addFilter(Filter.fromText("foo")); 258 FilterStorage.addFilter(Filter.fromText("foo"));
259 compareFiltersList(test, "Adding already added filter", [["foo"], ["@@bar", "f oo#bar", "foo#@#bar"], ["!foobar"]]); 259 compareFiltersList(test, "Adding already added filter", [["foo"], ["@@bar", "f oo##bar", "foo#@#bar"], ["!foobar"]]);
260 test.deepEqual(changes, [], "Received changes"); 260 test.deepEqual(changes, [], "Received changes");
261 261
262 subscription1.disabled = true; 262 subscription1.disabled = true;
263 263
264 changes = []; 264 changes = [];
265 FilterStorage.addFilter(Filter.fromText("foo")); 265 FilterStorage.addFilter(Filter.fromText("foo"));
266 compareFiltersList(test, "Adding filter already in a disabled subscription", [ ["foo"], ["@@bar", "foo#bar", "foo#@#bar"], ["!foobar", "foo"]]); 266 compareFiltersList(test, "Adding filter already in a disabled subscription", [ ["foo"], ["@@bar", "foo##bar", "foo#@#bar"], ["!foobar", "foo"]]);
267 test.deepEqual(changes, ["filter.added foo"], "Received changes"); 267 test.deepEqual(changes, ["filter.added foo"], "Received changes");
268 268
269 changes = []; 269 changes = [];
270 FilterStorage.addFilter(Filter.fromText("foo"), subscription1); 270 FilterStorage.addFilter(Filter.fromText("foo"), subscription1);
271 compareFiltersList(test, "Adding filter to an explicit subscription", [["foo", "foo"], ["@@bar", "foo#bar", "foo#@#bar"], ["!foobar", "foo"]]); 271 compareFiltersList(test, "Adding filter to an explicit subscription", [["foo", "foo"], ["@@bar", "foo##bar", "foo#@#bar"], ["!foobar", "foo"]]);
272 test.deepEqual(changes, ["filter.added foo"], "Received changes"); 272 test.deepEqual(changes, ["filter.added foo"], "Received changes");
273 273
274 changes = []; 274 changes = [];
275 FilterStorage.addFilter(Filter.fromText("!foobar"), subscription2, 0); 275 FilterStorage.addFilter(Filter.fromText("!foobar"), subscription2, 0);
276 compareFiltersList(test, "Adding filter to an explicit subscription with posit ion", [["foo", "foo"], ["!foobar", "@@bar", "foo#bar", "foo#@#bar"], ["!foobar", "foo"]]); 276 compareFiltersList(test, "Adding filter to an explicit subscription with posit ion", [["foo", "foo"], ["!foobar", "@@bar", "foo##bar", "foo#@#bar"], ["!foobar" , "foo"]]);
277 test.deepEqual(changes, ["filter.added !foobar"], "Received changes"); 277 test.deepEqual(changes, ["filter.added !foobar"], "Received changes");
278 278
279 test.done(); 279 test.done();
280 }; 280 };
281 281
282 exports.testRemovingFilters = function(test) 282 exports.testRemovingFilters = function(test)
283 { 283 {
284 let subscription1 = Subscription.fromURL("~foo"); 284 let subscription1 = Subscription.fromURL("~foo");
285 subscription1.filters = [Filter.fromText("foo"), Filter.fromText("foo"), Filte r.fromText("bar")]; 285 subscription1.filters = [Filter.fromText("foo"), Filter.fromText("foo"), Filte r.fromText("bar")];
286 286
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 compareFilterSubscriptions(test, "filter3 subscriptions after updating http:// test3/ filters", filter3, [subscription2]); 491 compareFilterSubscriptions(test, "filter3 subscriptions after updating http:// test3/ filters", filter3, [subscription2]);
492 492
493 FilterStorage.removeSubscription(subscription3); 493 FilterStorage.removeSubscription(subscription3);
494 494
495 compareFilterSubscriptions(test, "filter1 subscriptions after removing http:// test3/", filter1, []); 495 compareFilterSubscriptions(test, "filter1 subscriptions after removing http:// test3/", filter1, []);
496 compareFilterSubscriptions(test, "filter2 subscriptions after removing http:// test3/", filter2, [subscription2]); 496 compareFilterSubscriptions(test, "filter2 subscriptions after removing http:// test3/", filter2, [subscription2]);
497 compareFilterSubscriptions(test, "filter3 subscriptions after removing http:// test3/", filter3, [subscription2]); 497 compareFilterSubscriptions(test, "filter3 subscriptions after removing http:// test3/", filter3, [subscription2]);
498 498
499 test.done(); 499 test.done();
500 }; 500 };
OLDNEW
« test/filterClasses.js ('K') | « test/filterListener.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld