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

Unified Diff: test/abp2blocklist.js

Issue 29439639: Issue 4329 - Add $generichide support (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Patch Set: Fix indentation Created May 20, 2017, 12:20 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/abp2blocklist.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/abp2blocklist.js
===================================================================
--- a/test/abp2blocklist.js
+++ b/test/abp2blocklist.js
@@ -47,16 +47,32 @@
action: {type: "css-display-none", selector: ".whatever"}}
]);
test.done();
},
testElementHidingExceptions: function(test)
{
+ // Element hiding rules should be in the following order: (1) generic
+ // rules, (2) exceptions for generic rules, (3) domain-specific rules,
+ // (4) exceptions for all rules.
+ testRules(test, [
+ "##.whatever",
+ "test.com###something",
+ "@@||special.test.com^$elemhide",
+ "@@||test.com^$generichide"
+ ], [
+ ["^https?://", "css-display-none"],
+ ["^https?://([^/]+\\.)?test\\.com", "ignore-previous-rules"],
+ ["^https?://([^/:]*\\.)?test\\.com[/:]", "css-display-none"],
+ ["^https?://([^/]+\\.)?special\\.test\\.com", "ignore-previous-rules"]
+ ], rules => rules.map(rule => [rule.trigger["url-filter"],
+ rule.action.type]));
+
testRules(test, ["#@#whatever"], []);
testRules(test, ["test.com#@#whatever"], []);
testRules(test, ["~test.com#@#whatever"], []);
// We currently completely ignore any element hiding filters that have the
// same selector as an element hiding exception. In these examples #whatever
// should be hidden for all domains not ending in test.com instead of
// nowhere!
@@ -200,18 +216,17 @@
);
test.done();
},
testUnsupportedfilters: function(test)
{
// These types of filters are currently completely unsupported.
- testRules(test, ["foo$sitekey=bar", "@@foo$genericblock",
- "@@bar$generichide"], []);
+ testRules(test, ["foo$sitekey=bar", "@@foo$genericblock"], []);
test.done();
},
testFilterOptions: function(test)
{
testRules(test, ["1$domain=foo.com"], ["*foo.com"],
rules => rules[0]["trigger"]["if-domain"]);
« no previous file with comments | « lib/abp2blocklist.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld