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

Unified Diff: test/abp2blocklist.js

Issue 29441592: Issue 4329 - Add $genericblock support (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Patch Set: Add unit tests Created May 19, 2017, 2:10 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
« lib/abp2blocklist.js ('K') | « 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
@@ -149,16 +149,36 @@
{trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com/path",
"resource-type": ["font"]},
action: {type: "ignore-previous-rules"}}
]);
test.done();
},
+ testGenericblockExceptions: function(test)
+ {
+ testRules(test, ["^ad.jpg|", "@@||example.com^$genericblock"],
+ [[undefined, ["*example.com"]]],
+ rules => rules.map(rule => [rule.trigger["if-domain"],
+ rule.trigger["unless-domain"]]));
+ testRules(test, ["^ad.jpg|$domain=test.com",
+ "@@||example.com^$genericblock"],
+ [[["*test.com"], undefined]],
+ rules => rules.map(rule => [rule.trigger["if-domain"],
+ rule.trigger["unless-domain"]]));
+ testRules(test, ["^ad.jpg|$domain=~test.com",
+ "@@||example.com^$genericblock"],
+ [[undefined, ["*example.com", "*test.com"]]],
+ rules => rules.map(rule => [rule.trigger["if-domain"],
+ rule.trigger["unless-domain"]]));
+
+ test.done();
+ },
+
testRuleOrdering: function(test)
{
testRules(
test,
["/ads.jpg", "@@example.com", "test.com#@#foo", "##bar"],
["css-display-none", "block", "ignore-previous-rules"],
rules => rules.map(rule => rule.action.type)
);
@@ -200,18 +220,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", "@@bar$generichide"], []);
test.done();
},
testFilterOptions: function(test)
{
testRules(test, ["1$domain=foo.com"], ["*foo.com"],
rules => rules[0]["trigger"]["if-domain"]);
« lib/abp2blocklist.js ('K') | « lib/abp2blocklist.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld