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

Delta Between Two Patch Sets: test/browser/elemHideEmulation.js

Issue 29770601: Issue 6649 - Allow u flag in :-abp-contains() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created May 5, 2018, 1:46 a.m.
Right Patch Set: Add tests Created May 5, 2018, 2 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « lib/content/elemHideEmulation.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 test, "div:-abp-has(> span:-abp-contains(Advertisment))", expectations); 487 test, "div:-abp-has(> span:-abp-contains(Advertisment))", expectations);
488 }; 488 };
489 489
490 function runTestPseudoClassContains(test, selector, expectations) 490 function runTestPseudoClassContains(test, selector, expectations)
491 { 491 {
492 testDocument.body.innerHTML = `<div id="parent"> 492 testDocument.body.innerHTML = `<div id="parent">
493 <div id="middle"> 493 <div id="middle">
494 <div id="middle1"><div id="inside" class="inside"></div></div> 494 <div id="middle1"><div id="inside" class="inside"></div></div>
495 </div> 495 </div>
496 <div id="sibling"> 496 <div id="sibling">
497 <div id="tohide">to hide</div> 497 <div id="tohide">to hide \ud83d\ude42!</div>
498 </div> 498 </div>
499 <div id="sibling2"> 499 <div id="sibling2">
500 <div id="sibling21"><div id="sibling211" class="inside">Ad*</div></div> 500 <div id="sibling21"><div id="sibling211" class="inside">Ad*</div></div>
501 </div> 501 </div>
502 </div>`; 502 </div>`;
503 let elems = { 503 let elems = {
504 parent: testDocument.getElementById("parent"), 504 parent: testDocument.getElementById("parent"),
505 middle: testDocument.getElementById("middle"), 505 middle: testDocument.getElementById("middle"),
506 inside: testDocument.getElementById("inside"), 506 inside: testDocument.getElementById("inside"),
507 sibling: testDocument.getElementById("sibling"), 507 sibling: testDocument.getElementById("sibling"),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 middle: true, 551 middle: true,
552 inside: true, 552 inside: true,
553 sibling: false, 553 sibling: false,
554 sibling2: true, 554 sibling2: true,
555 toHide: true 555 toHide: true
556 }; 556 };
557 runTestPseudoClassContains( 557 runTestPseudoClassContains(
558 test, "#parent div:-abp-contains(/to\\sHide/i)", expectations); 558 test, "#parent div:-abp-contains(/to\\sHide/i)", expectations);
559 }; 559 };
560 560
561 exports.testPseudoClassContainsRegexpUFlag = function(test)
562 {
563 let expectations = {
564 parent: true,
565 middle: true,
566 inside: true,
567 sibling: false,
568 sibling2: true,
569 toHide: true
570 };
571 runTestPseudoClassContains(
572 test, "#parent div:-abp-contains(/to\\shide\\s.!/u)", expectations);
Manish Jethani 2018/05/05 02:01:49 With the u flag the dot will match the entire Unic
573 };
574
561 exports.testPseudoClassContainsWildcardNoMatch = function(test) 575 exports.testPseudoClassContainsWildcardNoMatch = function(test)
562 { 576 {
563 let expectations = { 577 let expectations = {
564 parent: true, 578 parent: true,
565 middle: true, 579 middle: true,
566 inside: true, 580 inside: true,
567 sibling: true, 581 sibling: true,
568 sibling2: true, 582 sibling2: true,
569 toHide: true 583 toHide: true
570 }; 584 };
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 891
878 return timeout(REFRESH_INTERVAL); 892 return timeout(REFRESH_INTERVAL);
879 }).then(() => 893 }).then(() =>
880 { 894 {
881 // Note: Even though it runs both the :-abp-contains() patterns, it only 895 // Note: Even though it runs both the :-abp-contains() patterns, it only
882 // hides the parent element because of revision d7d51d29aa34. 896 // hides the parent element because of revision d7d51d29aa34.
883 expectHidden(test, parent); 897 expectHidden(test, parent);
884 expectVisible(test, child); 898 expectVisible(test, child);
885 }).catch(unexpectedError.bind(test)).then(() => test.done()); 899 }).catch(unexpectedError.bind(test)).then(() => test.done());
886 }; 900 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld