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

Side by Side Diff: test/filterClasses.js

Issue 29383960: Issue 3143 - Filter elements with :-abp-has() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Moved unwrap to filterClass, ES6 syntax, use :-abp-has(), don't modify DOM to select, rebased on 29… Created April 27, 2017, 4:10 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 | « test/browser/elemHideEmulation.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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 compareFilter(test, "~foo.com,bar.com##[-abp-properties='abc']", ["type=elemhi deemulation", "text=~foo.com,bar.com##[-abp-properties='abc']", "selectorDomain= bar.com", "selector=[-abp-properties='abc']", "domains=BAR.COM|~FOO.COM"]); 359 compareFilter(test, "~foo.com,bar.com##[-abp-properties='abc']", ["type=elemhi deemulation", "text=~foo.com,bar.com##[-abp-properties='abc']", "selectorDomain= bar.com", "selector=[-abp-properties='abc']", "domains=BAR.COM|~FOO.COM"]);
360 360
361 compareFilter(test, "##[-abp-properties='']", ["type=invalid", "text=##[-abp-p roperties='']", "reason=filter_elemhideemulation_nodomain"]); 361 compareFilter(test, "##[-abp-properties='']", ["type=invalid", "text=##[-abp-p roperties='']", "reason=filter_elemhideemulation_nodomain"]);
362 compareFilter(test, "foo.com#@#[-abp-properties='abc']", ["type=elemhideexcept ion", "text=foo.com#@#[-abp-properties='abc']", "selectorDomain=foo.com", "selec tor=[-abp-properties='abc']", "domains=FOO.COM"]); 362 compareFilter(test, "foo.com#@#[-abp-properties='abc']", ["type=elemhideexcept ion", "text=foo.com#@#[-abp-properties='abc']", "selectorDomain=foo.com", "selec tor=[-abp-properties='abc']", "domains=FOO.COM"]);
363 compareFilter(test, "foo.com##aaa [-abp-properties='abc'] bbb", ["type=elemhid eemulation", "text=foo.com##aaa [-abp-properties='abc'] bbb", "selectorDomain=fo o.com", "selector=aaa [-abp-properties='abc'] bbb", "domains=FOO.COM"]); 363 compareFilter(test, "foo.com##aaa [-abp-properties='abc'] bbb", ["type=elemhid eemulation", "text=foo.com##aaa [-abp-properties='abc'] bbb", "selectorDomain=fo o.com", "selector=aaa [-abp-properties='abc'] bbb", "domains=FOO.COM"]);
364 compareFilter(test, "foo.com##[-abp-properties='|background-image: url(data:*) ']", ["type=elemhideemulation", "text=foo.com##[-abp-properties='|background-ima ge: url(data:*)']", "selectorDomain=foo.com", "selector=[-abp-properties='|backg round-image: url(data:*)']", "domains=FOO.COM"]); 364 compareFilter(test, "foo.com##[-abp-properties='|background-image: url(data:*) ']", ["type=elemhideemulation", "text=foo.com##[-abp-properties='|background-ima ge: url(data:*)']", "selectorDomain=foo.com", "selector=[-abp-properties='|backg round-image: url(data:*)']", "domains=FOO.COM"]);
365 365
366 // test matching -abp-properties= (https://issues.adblockplus.org/ticket/5037) . 366 // test matching -abp-properties= (https://issues.adblockplus.org/ticket/5037) .
367 compareFilter(test, "foo.com##[-abp-properties-bogus='abc']", ["type=elemhide" , "text=foo.com##[-abp-properties-bogus='abc']", "selectorDomain=foo.com", "sele ctor=[-abp-properties-bogus='abc']", "domains=FOO.COM"]); 367 compareFilter(test, "foo.com##[-abp-properties-bogus='abc']", ["type=elemhide" , "text=foo.com##[-abp-properties-bogus='abc']", "selectorDomain=foo.com", "sele ctor=[-abp-properties-bogus='abc']", "domains=FOO.COM"]);
368 368
369 // Check extended CSS filter
370 compareFilter(test, "~foo.com,bar.com##[-abp-selector=':-abp-has(div > span)'] ", ["type=elemhideemulation", "text=~foo.com,bar.com##[-abp-selector=':-abp-has( div > span)']", "selectorDomain=bar.com", "selector=:-abp-has(div > span)", "dom ains=BAR.COM|~FOO.COM"]);
371 compareFilter(test, "##[-abp-selector=':-abp-has(div > span)']", ["type=invali d", "text=##[-abp-selector=':-abp-has(div > span)']", "reason=filter_elemhideemu lation_nodomain"]);
372
369 test.done(); 373 test.done();
370 }; 374 };
371 375
372 exports.testEmptyElemHideDomains = function(test) 376 exports.testEmptyElemHideDomains = function(test)
373 { 377 {
374 let emptyDomainFilters = [ 378 let emptyDomainFilters = [
375 ",##selector", ",,,##selector", "~,foo.com##selector", "foo.com,##selector", 379 ",##selector", ",,,##selector", "~,foo.com##selector", "foo.com,##selector",
376 ",foo.com##selector", "foo.com,~##selector", 380 ",foo.com##selector", "foo.com,~##selector",
377 "foo.com,,bar.com##selector", "foo.com,~,bar.com##selector" 381 "foo.com,,bar.com##selector", "foo.com,~,bar.com##selector"
378 ]; 382 ];
(...skipping 23 matching lines...) Expand all
402 test, "foo.com##[-abp-properties='/margin: [3-4]{2}/']", [ 406 test, "foo.com##[-abp-properties='/margin: [3-4]{2}/']", [
403 "type=elemhideemulation", 407 "type=elemhideemulation",
404 "text=foo.com##[-abp-properties='/margin: [3-4]{2}/']", 408 "text=foo.com##[-abp-properties='/margin: [3-4]{2}/']",
405 "selectorDomain=foo.com", 409 "selectorDomain=foo.com",
406 "selector=[-abp-properties='/margin: [3-4]\\x7B 2\\x7D /']", 410 "selector=[-abp-properties='/margin: [3-4]\\x7B 2\\x7D /']",
407 "domains=FOO.COM" 411 "domains=FOO.COM"
408 ] 412 ]
409 ); 413 );
410 test.done(); 414 test.done();
411 }; 415 };
OLDNEW
« no previous file with comments | « test/browser/elemHideEmulation.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld