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

Side by Side Diff: test/filterClasses.js

Issue 29746563: Noissue - Trim spaces around element hiding emulation selectors (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Add tests Created April 10, 2018, 12:58 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/filterClasses.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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 "ads"); 424 "ads");
425 425
426 // Comment filters 426 // Comment filters
427 test.equal(Filter.normalize(" ! fo o## bar "), 427 test.equal(Filter.normalize(" ! fo o## bar "),
428 "! fo o## bar"); 428 "! fo o## bar");
429 429
430 // Element hiding filters 430 // Element hiding filters
431 test.equal(Filter.normalize(" domain.c om## # sele ctor "), 431 test.equal(Filter.normalize(" domain.c om## # sele ctor "),
432 "domain.com### sele ctor"); 432 "domain.com### sele ctor");
433 433
434 // Element hiding emulation filters
435 test.equal(Filter.normalize(" domain.c om#?# # sele ctor "),
kzar 2018/04/11 11:29:49 What about a test for something like "domain.com#
Manish Jethani 2018/04/11 11:50:19 Interesting, the test would pass for "# ?#" but no
kzar 2018/04/11 12:04:09 Well it's good that we're being consistent now, bu
Manish Jethani 2018/04/11 17:34:54 OK, I thought about this a little bit. elemhideReg
436 "domain.com#?## sele ctor");
437
438 // Element hiding exception filters
439 test.equal(Filter.normalize(" domain.c om#@# # sele ctor "),
440 "domain.com#@## sele ctor");
441
434 // Regular filters 442 // Regular filters
435 let normalized = Filter.normalize( 443 let normalized = Filter.normalize(
436 " b$l a$sitekey= foo ,domain= do main.com |foo .com,c sp= c s p " 444 " b$l a$sitekey= foo ,domain= do main.com |foo .com,c sp= c s p "
437 ); 445 );
438 test.equal( 446 test.equal(
439 normalized, 447 normalized,
440 "b$la$sitekey=foo,domain=domain.com|foo.com,csp=c s p" 448 "b$la$sitekey=foo,domain=domain.com|foo.com,csp=c s p"
441 ); 449 );
442 compareFilter( 450 compareFilter(
443 test, normalized, [ 451 test, normalized, [
(...skipping 24 matching lines...) Expand all
468 "foo$csp=bar,$csp=c s p"); 476 "foo$csp=bar,$csp=c s p");
469 test.equal(Filter.normalize(" f o o $ bar $csp=ba r"), 477 test.equal(Filter.normalize(" f o o $ bar $csp=ba r"),
470 "foo$bar$csp=ba r"); 478 "foo$bar$csp=ba r");
471 test.equal(Filter.normalize("f $ o $ o $ csp=f o o "), 479 test.equal(Filter.normalize("f $ o $ o $ csp=f o o "),
472 "f$o$o$csp=f o o"); 480 "f$o$o$csp=f o o");
473 test.equal(Filter.normalize("/foo$/$ csp = script-src http://example.com/?$1= 1&$2=2&$3=3"), 481 test.equal(Filter.normalize("/foo$/$ csp = script-src http://example.com/?$1= 1&$2=2&$3=3"),
474 "/foo$/$csp=script-src http://example.com/?$1=1&$2=2&$3=3"); 482 "/foo$/$csp=script-src http://example.com/?$1=1&$2=2&$3=3");
475 483
476 test.done(); 484 test.done();
477 }; 485 };
OLDNEW
« no previous file with comments | « lib/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld