OLD | NEW |
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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 middile: true, | 522 middile: true, |
523 inside: true, | 523 inside: true, |
524 sibling: true, | 524 sibling: true, |
525 sibling2: true, | 525 sibling2: true, |
526 toHide: true | 526 toHide: true |
527 }; | 527 }; |
528 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling( | 528 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling( |
529 test, "div:-abp-has(> span:-abp-contains(Advertisment))", expectations); | 529 test, "div:-abp-has(> span:-abp-contains(Advertisment))", expectations); |
530 }; | 530 }; |
531 | 531 |
| 532 async function runTestQualifier(test, selector) |
| 533 { |
| 534 testDocument.body.innerHTML = ` |
| 535 <style> |
| 536 span::before { |
| 537 content: "any"; |
| 538 } |
| 539 </style> |
| 540 <div id="toHide"> |
| 541 <a> |
| 542 <p> |
| 543 <span></span> |
| 544 </p> |
| 545 </a> |
| 546 </div>`; |
| 547 |
| 548 if (await applyElemHideEmulation(test, [selector])) |
| 549 expectHidden(test, testDocument.getElementById("toHide")); |
| 550 |
| 551 test.done(); |
| 552 } |
| 553 |
| 554 // See issue https://issues.adblockplus.org/ticket/7428 |
| 555 exports.testPropertySelectorCombinatorQualifier = function(test) |
| 556 { |
| 557 runTestQualifier( |
| 558 test, |
| 559 "div:-abp-has(> a p > :-abp-properties(content: \"any\"))" |
| 560 ); |
| 561 }; |
| 562 |
| 563 // See issue https://issues.adblockplus.org/ticket/7359 |
| 564 exports.testPropertySelectorCombinatorQualifierNested = function(test) |
| 565 { |
| 566 runTestQualifier( |
| 567 test, |
| 568 "div:-abp-has(> a p:-abp-has(> :-abp-properties(content: \"any\")))" |
| 569 ); |
| 570 }; |
| 571 |
| 572 // See issue https://issues.adblockplus.org/ticket/7400 |
| 573 exports.testPropertySelectorIdenticalTypeQualifier = function(test) |
| 574 { |
| 575 runTestQualifier( |
| 576 test, |
| 577 "div:-abp-has(span:-abp-properties(content: \"any\"))" |
| 578 ); |
| 579 }; |
| 580 |
| 581 // See issue https://issues.adblockplus.org/ticket/7400 |
| 582 exports.testPropertySelectorIdenticalTypeQualifierNested = function(test) |
| 583 { |
| 584 runTestQualifier( |
| 585 test, |
| 586 "div:-abp-has(p:-abp-has(span:-abp-properties(content: \"any\")))" |
| 587 ); |
| 588 }; |
| 589 |
532 async function runTestPseudoClassContains(test, selector, expectations) | 590 async function runTestPseudoClassContains(test, selector, expectations) |
533 { | 591 { |
534 testDocument.body.innerHTML = `<div id="parent"> | 592 testDocument.body.innerHTML = `<div id="parent"> |
535 <div id="middle"> | 593 <div id="middle"> |
536 <div id="middle1"><div id="inside" class="inside"></div></div> | 594 <div id="middle1"><div id="inside" class="inside"></div></div> |
537 </div> | 595 </div> |
538 <div id="sibling"> | 596 <div id="sibling"> |
539 <div id="tohide">to hide \ud83d\ude42!</div> | 597 <div id="tohide">to hide \ud83d\ude42!</div> |
540 </div> | 598 </div> |
541 <div id="sibling2"> | 599 <div id="sibling2"> |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 { | 1123 { |
1066 if (element.id == "n2" || element.id == "n2_3") | 1124 if (element.id == "n2" || element.id == "n2_3") |
1067 expectProcessed(test, element, element.id); | 1125 expectProcessed(test, element, element.id); |
1068 else | 1126 else |
1069 expectNotProcessed(test, element, element.id); | 1127 expectNotProcessed(test, element, element.id); |
1070 } | 1128 } |
1071 } | 1129 } |
1072 | 1130 |
1073 test.done(); | 1131 test.done(); |
1074 }; | 1132 }; |
OLD | NEW |