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

Unified Diff: chrome/content/tests/elemhide.js

Issue 6439460933730304: Issue 616 - Add tests for $generichide and $genericblock (Closed)
Patch Set: Couple more tweaks Created Oct. 2, 2015, 10:37 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 | « no previous file | chrome/content/tests/filterClasses.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/tests/elemhide.js
diff --git a/chrome/content/tests/elemhide.js b/chrome/content/tests/elemhide.js
index c1b9d7a6c9433e8b1826bbf6fdd2587a6953db57..979aecdaaf672878b54b497fbed9b1d20e891bf0 100644
--- a/chrome/content/tests/elemhide.js
+++ b/chrome/content/tests/elemhide.js
@@ -106,6 +106,13 @@
[["localhost.###test1"], ["visible", "visible"]],
[["localhost.,localhost###test1"], ["hidden", "visible"]],
[["localhost.,foo.###test1"], ["visible", "visible"]],
+
+ [["##div#test1", "@@localhost$generichide"], ["visible", "visible"]],
+ [["##div#test1", "@@localhost$genericblock"], ["hidden", "visible"]],
+ [["localhost##div#test1", "@@localhost$generichide"], ["hidden", "visible"]],
+ [["~example.com##div#test1", "@@localhost$generichide"], ["visible", "visible"]],
+ [["~example.com##div#test1", "@@localhost$genericblock"], ["hidden", "visible"]],
+ [["~example.com,localhost##div#test1", "@@localhost$generichide"], ["hidden", "visible"]],
];
function runTest([filters, expected], stage)
@@ -138,11 +145,18 @@
});
}, false, true);
frame.setAttribute("src", "http://localhost:1234/test");
- }
+ };
FilterNotifier.addListener(listener);
- for (let filter of filters)
- ElemHide.add(Filter.fromText(filter));
+ for (let filter_text of filters)
+ {
+ let filter = Filter.fromText(filter_text);
+ if (filter instanceof WhitelistFilter)
+ defaultMatcher.add(filter);
+ else
+ ElemHide.add(filter);
+ }
+
ElemHide.isDirty = true;
ElemHide.apply();
}
« no previous file with comments | « no previous file | chrome/content/tests/filterClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld