| 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"]); |