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

Unified Diff: test/browser/elemHideEmulation.js

Issue 29493648: Issue 5436 - Allow relative selectors in :-abp-has() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Remove unecessary changes Created Aug. 14, 2017, 2:30 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
@@ -362,56 +362,80 @@
{
expectVisible(test, parent);
expectVisible(test, middle);
expectVisible(test, sibling);
expectHidden(test, toHide);
}).catch(unexpectedError.bind(test)).then(() => test.done());
};
-function runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, selector)
+function runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, selector, expectation)
{
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");
+ let elems = {};
+ elems.parent = document.getElementById("parent");
+ elems.middle = document.getElementById("middle");
+ elems.inside = document.getElementById("inside");
+ elems.sibling = document.getElementById("sibling");
+ elems.sibling2 = document.getElementById("sibling2");
+ elems.toHide = document.getElementById("tohide");
Wladimir Palant 2017/08/16 08:17:16 Please assign a proper object literal: let elem
hub 2017/08/16 15:30:46 Done.
insertStyleRule(".inside {}");
applyElemHideEmulation(
[selector]
).then(() =>
{
- expectVisible(test, parent);
- expectVisible(test, middle);
- expectVisible(test, inside);
- expectVisible(test, sibling);
- expectVisible(test, sibling2);
- expectHidden(test, toHide);
+ if (typeof expectation == "function")
+ return expectation(elems);
Wladimir Palant 2017/08/16 08:17:15 Handling the expectations here for two scenarios b
hub 2017/08/16 15:30:45 Done.
+
+ expectVisible(test, elems.parent);
+ expectVisible(test, elems.middle);
+ expectVisible(test, elems.inside);
+ expectVisible(test, elems.sibling);
+ expectVisible(test, elems.sibling2);
+ expectHidden(test, elems.toHide);
}).catch(unexpectedError.bind(test)).then(() => test.done());
}
exports.testPseudoClassHasSelectorWithHasAndWithSuffixSibling = function(test)
{
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.testPseudoClassHasSelectorWithSuffixSiblingNoop = function(test)
+{
+ runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(
+ test, "div:-abp-has(> body div.inside) + div > div", (elems) =>
+ {
+ expectVisible(test, elems.parent);
+ expectVisible(test, elems.middle);
+ expectVisible(test, elems.inside);
+ expectVisible(test, elems.sibling);
+ expectVisible(test, elems.sibling2);
+ expectVisible(test, elems.toHide);
+ });
+};
+
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>
« 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