Index: test/browser/elemHideEmulation.js |
=================================================================== |
--- a/test/browser/elemHideEmulation.js |
+++ b/test/browser/elemHideEmulation.js |
@@ -533,34 +533,75 @@ |
toHide: true |
}; |
runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling( |
test, "div:-abp-has(> span:-abp-contains(Advertisment))", expectations); |
}; |
async function runTestPseudoClassContains(test, selector, expectations) |
{ |
- testDocument.body.innerHTML = `<div id="parent"> |
+ testDocument.body.innerHTML = ` <style type="text/css"> |
+ body { |
+ margin: 0; |
+ padding: 0; |
+ } |
+ .transparent { |
+ opacity: 0; |
+ position: absolute; |
+ display: block; |
+ } |
+ .zerosize { |
+ font-size: 0; |
+ } |
+ div { |
+ display: block; |
+ } |
+ .a { |
+ display: inline-block; |
+ white-space: pre-wrap; |
+ } |
+ .disp_none { |
+ display: none; |
+ } |
+ .vis_hid { |
+ visibility: hidden; |
+ } |
+ .vis_collapse { |
+ visibility: collapse; |
+ } |
+ .same_colour { |
+ color: rgb(255,255,255); |
+ background-color: rgb(255,255,255); |
+ } |
+ #label { |
+ overflow-wrap: break-word; |
+ } |
+ </style> |
+ <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 \ud83d\ude42!</div> |
</div> |
<div id="sibling2"> |
<div id="sibling21"><div id="sibling211" class="inside">Ad*</div></div> |
</div> |
+ <div id="label"><div id="content"><div class="a transparent">Sp</div><div class="a">Sp</div><div class="a zerosize">S</div><div class="a transparent">on</div><div class="a">on</div><div class="a zerosize">S</div></div></div> |
+ <div id="label2"><div class="a vis_hid">Visibility: hidden</div><div class="a">S</div><div class="a vis_collapse">Visibility: collapse</div><div class="a">p</div><div class="a disp_none">Display: none</div><div class="a">o</div><div class="a same_colour">Same colour</div><div class="a">n</div></div> |
</div>`; |
let elems = { |
parent: testDocument.getElementById("parent"), |
middle: testDocument.getElementById("middle"), |
inside: testDocument.getElementById("inside"), |
sibling: testDocument.getElementById("sibling"), |
sibling2: testDocument.getElementById("sibling2"), |
- toHide: testDocument.getElementById("tohide") |
+ toHide: testDocument.getElementById("tohide"), |
+ label: testDocument.getElementById("label"), |
+ label2: testDocument.getElementById("label2") |
}; |
if (await applyElemHideEmulation(test, [selector])) |
compareExpectations(test, elems, expectations); |
test.done(); |
} |
@@ -587,16 +628,32 @@ |
sibling: false, |
sibling2: true, |
toHide: true |
}; |
runTestPseudoClassContains( |
test, "#parent div:-abp-contains(/to\\shide/)", expectations); |
}; |
+exports.testPseudoClassContainsVisibleText = function(test) |
+{ |
+ let expectations = { |
+ parent: true, |
+ middle: true, |
+ inside: true, |
+ sibling: true, |
+ sibling2: true, |
+ toHide: true, |
+ label: false, |
+ label2: false |
+ }; |
+ runTestPseudoClassContains( |
+ test, "#parent div:-abp-contains-visible(Spon)", expectations); |
+}; |
+ |
exports.testPseudoClassContainsRegexpIFlag = function(test) |
{ |
let expectations = { |
parent: true, |
middle: true, |
inside: true, |
sibling: false, |
sibling2: true, |