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

Side by Side Diff: test/elemHide.js

Issue 29882558: Issue 6955 - Avoid making copies of common selector list (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Sept. 16, 2018, 4:07 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/elemHide.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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 test.equal(filtersByDomain.size, 2); 266 test.equal(filtersByDomain.size, 2);
267 267
268 ElemHide.remove(Filter.fromText("example.com##test")); 268 ElemHide.remove(Filter.fromText("example.com##test"));
269 test.equal(filtersByDomain.size, 2); 269 test.equal(filtersByDomain.size, 2);
270 270
271 ElemHide.remove(Filter.fromText("example.com,~www.example.com##test")); 271 ElemHide.remove(Filter.fromText("example.com,~www.example.com##test"));
272 test.equal(filtersByDomain.size, 0); 272 test.equal(filtersByDomain.size, 0);
273 273
274 test.done(); 274 test.done();
275 }; 275 };
276
277 exports.testGenericSelectorDedup = function(test)
278 {
279 ElemHide.add(Filter.fromText("##test1"));
280 ElemHide.add(Filter.fromText("##test2"));
281 ElemHide.add(Filter.fromText("##test3"));
282
283 test.equal(ElemHide.getSelectorsForDomain("foo.example.com"),
284 ElemHide.getSelectorsForDomain("bar.example.com"));
285
286 ElemHide.add(Filter.fromText("foo.example.com##test4"));
287
288 test.notEqual(ElemHide.getSelectorsForDomain("foo.example.com"),
289 ElemHide.getSelectorsForDomain("bar.example.com"));
290
291 ElemHide.remove(Filter.fromText("foo.example.com##test4"));
292
293 test.equal(ElemHide.getSelectorsForDomain("foo.example.com"),
294 ElemHide.getSelectorsForDomain("bar.example.com"));
295
296 ElemHide.remove(Filter.fromText("##test1"));
297 ElemHide.remove(Filter.fromText("##test2"));
298 ElemHide.remove(Filter.fromText("##test3"));
299
300 test.equal(ElemHide.getSelectorsForDomain("foo.example.com"),
301 ElemHide.getSelectorsForDomain("bar.example.com"));
302
303 test.done();
304 };
OLDNEW
« no previous file with comments | « lib/elemHide.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld