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

Unified Diff: test/browser/elemHideEmulation.js

Issue 29448560: Issue 5249 - Implement :-abp-contains() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Added test for :-abp-contains Created June 21, 2017, 9:38 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/content/elemHideEmulation.js ('K') | « chrome/content/elemHideEmulation.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/browser/elemHideEmulation.js
===================================================================
--- a/test/browser/elemHideEmulation.js
+++ b/test/browser/elemHideEmulation.js
@@ -387,16 +387,49 @@
runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, "div:-abp-has(:-abp-has(div.inside)) + div > div");
};
exports.testPseudoClassHasSelectorWithHasAndWithSuffixSibling2 = function(test)
{
runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, "div:-abp-has(:-abp-has(> div.inside)) + div > div");
};
+exports.testPseudoClassContains = function(test)
+{
+ document.body.innerHTML = `<div id="parent">
+ <div id="middle">
+ <div id="middle1"><div id="inside" class="inside"></div></div>
+ </div>
+ <div id="sibling">
+ <div id="tohide">to hide</div>
+ </div>
+ <div id="sibling2">
+ <div id="sibling21"><div id="sibling211" class="inside"></div></div>
+ </div>
+ </div>`;
+ let parent = document.getElementById("parent");
+ let middle = document.getElementById("middle");
+ let inside = document.getElementById("inside");
+ let sibling = document.getElementById("sibling");
+ let sibling2 = document.getElementById("sibling2");
+ let toHide = document.getElementById("tohide");
+
+ applyElemHideEmulation(
+ ["div > div > :-abp-contains(to hide)"]
Wladimir Palant 2017/06/28 10:47:24 How about "#parent > div:-abp-contains(to hide)"?
Wladimir Palant 2017/06/28 14:53:56 Did you overlook this comment?
hub 2017/06/28 16:11:35 I did. but "#parent > div:-abp-contains(to hide)"
+ ).then(() =>
+ {
+ expectVisible(test, parent);
+ expectVisible(test, middle);
+ expectVisible(test, inside);
+ expectVisible(test, sibling);
+ expectVisible(test, sibling2);
+ expectHidden(test, toHide);
+ }).catch(unexpectedError.bind(test)).then(() => test.done());
+};
+
exports.testPseudoClassHasSelectorWithPropSelector = function(test)
{
let parent = createElementWithStyle("{}");
let child = createElementWithStyle("{background-color: #000}", parent);
applyElemHideEmulation(
["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"]
).then(() =>
{
« chrome/content/elemHideEmulation.js ('K') | « chrome/content/elemHideEmulation.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld