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

Unified Diff: test/browser/elemHideEmulation.js

Issue 29494577: Issue 5438 - Observer DOM changes to reapply filters. (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: And now the test, with issues Created Aug. 23, 2017, 12:57 a.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
« no previous file with comments | « lib/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
@@ -479,8 +479,103 @@
applyElemHideEmulation(
["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"]
).then(() =>
{
expectVisible(test, child);
expectHidden(test, parent);
}).catch(unexpectedError.bind(test)).then(() => test.done());
};
+
+exports.testDomUpdatesStyle = function(test)
+{
+ let parent = createElementWithStyle("{}");
+ let child = createElementWithStyle("{}", parent);
+ applyElemHideEmulation(
+ ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"]
+ ).then(() =>
+ {
+ expectVisible(test, child);
+ expectVisible(test, parent);
+
+ insertStyleRule("body #" + parent.id + " > div { background-color: #000}");
+
+ return new Promise((resolve, reject) =>
+ {
+ expectVisible(test, child);
+ expectVisible(test, parent);
+ window.setTimeout(() =>
+ {
+ //expectVisible(test, child);
hub 2017/08/23 01:11:31 This is where test are running into problems. This
+ expectHidden(test, parent);
+ resolve();
+ }, 4000);
+ });
+ }).catch(unexpectedError.bind(test)).then(() => test.done());
+};
+
+exports.testDomUpdatesContent = function(test)
+{
+ let parent = createElementWithStyle("{}");
+ let child = createElementWithStyle("{}", parent);
+ applyElemHideEmulation(
+ ["div:-abp-contains(hide me)"]
+ ).then(() =>
+ {
+ expectVisible(test, parent);
+ expectVisible(test, child);
+
+ child.innerText = "hide me";
+ return new Promise((resolve, reject) =>
+ {
+ expectVisible(test, parent);
+ expectVisible(test, child);
+ window.setTimeout(() =>
+ {
+ expectVisible(test, parent);
hub 2017/08/23 01:11:31 This one not commented out fail.
+ expectHidden(test, child);
+ resolve();
+ }, 4000);
+ });
+ }).catch(unexpectedError.bind(test)).then(() => test.done());
+};
+
+exports.testDomUpdatesNewElement = 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(() =>
+ {
+ expectHidden(test, parent);
+ expectVisible(test, child);
+
+ let sibling = createElementWithStyle("{}");
+ expectVisible(test, sibling);
+
+ return new Promise((resolve, reject) =>
+ {
+ expectHidden(test, parent);
+ expectVisible(test, child);
+ expectVisible(test, sibling);
+ window.setTimeout(() =>
+ {
+ expectHidden(test, parent);
+ //expectVisible(test, child);
+ //expectVisible(test, sibling);
+
+ let child2 = createElementWithStyle("{ background-color: #000}",
+ sibling);
+ expectVisible(test, child2);
+ window.setTimeout(() =>
+ {
+ expectHidden(test, parent);
+ //expectVisible(test, child);
+ expectHidden(test, sibling);
+ //expectVisible(test, child2);
+
+ resolve();
+ }, 4000);
+ }, 4000);
+ });
+ }).catch(unexpectedError.bind(test)).then(() => test.done());
+};
« no previous file with comments | « lib/content/elemHideEmulation.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld