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-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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 exports.testPseudoClassHasSelectorWithHasAndWithSuffixSibling = function(test) | 385 exports.testPseudoClassHasSelectorWithHasAndWithSuffixSibling = function(test) |
386 { | 386 { |
387 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, "div:-abp-has(:
-abp-has(div.inside)) + div > div"); | 387 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, "div:-abp-has(:
-abp-has(div.inside)) + div > div"); |
388 }; | 388 }; |
389 | 389 |
390 exports.testPseudoClassHasSelectorWithHasAndWithSuffixSibling2 = function(test) | 390 exports.testPseudoClassHasSelectorWithHasAndWithSuffixSibling2 = function(test) |
391 { | 391 { |
392 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, "div:-abp-has(:
-abp-has(> div.inside)) + div > div"); | 392 runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, "div:-abp-has(:
-abp-has(> div.inside)) + div > div"); |
393 }; | 393 }; |
394 | 394 |
| 395 exports.testPseudoClassContains = function(test) |
| 396 { |
| 397 document.body.innerHTML = `<div id="parent"> |
| 398 <div id="middle"> |
| 399 <div id="middle1"><div id="inside" class="inside"></div></div> |
| 400 </div> |
| 401 <div id="sibling"> |
| 402 <div id="tohide">to hide</div> |
| 403 </div> |
| 404 <div id="sibling2"> |
| 405 <div id="sibling21"><div id="sibling211" class="inside"></div></div> |
| 406 </div> |
| 407 </div>`; |
| 408 let parent = document.getElementById("parent"); |
| 409 let middle = document.getElementById("middle"); |
| 410 let inside = document.getElementById("inside"); |
| 411 let sibling = document.getElementById("sibling"); |
| 412 let sibling2 = document.getElementById("sibling2"); |
| 413 let toHide = document.getElementById("tohide"); |
| 414 |
| 415 applyElemHideEmulation( |
| 416 ["div > div > :-abp-contains(to hide)"] |
| 417 ).then(() => |
| 418 { |
| 419 expectVisible(test, parent); |
| 420 expectVisible(test, middle); |
| 421 expectVisible(test, inside); |
| 422 expectVisible(test, sibling); |
| 423 expectVisible(test, sibling2); |
| 424 expectHidden(test, toHide); |
| 425 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
| 426 }; |
| 427 |
395 exports.testPseudoClassHasSelectorWithPropSelector = function(test) | 428 exports.testPseudoClassHasSelectorWithPropSelector = function(test) |
396 { | 429 { |
397 let parent = createElementWithStyle("{}"); | 430 let parent = createElementWithStyle("{}"); |
398 let child = createElementWithStyle("{background-color: #000}", parent); | 431 let child = createElementWithStyle("{background-color: #000}", parent); |
399 applyElemHideEmulation( | 432 applyElemHideEmulation( |
400 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"] | 433 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"] |
401 ).then(() => | 434 ).then(() => |
402 { | 435 { |
403 expectVisible(test, child); | 436 expectVisible(test, child); |
404 expectHidden(test, parent); | 437 expectHidden(test, parent); |
405 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 438 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
406 }; | 439 }; |
OLD | NEW |