Index: test/filterStorage.js |
=================================================================== |
--- a/test/filterStorage.js |
+++ b/test/filterStorage.js |
@@ -205,17 +205,17 @@ |
}; |
exports.testAddingFilters = function(test) |
{ |
let subscription1 = Subscription.fromURL("~blocking"); |
subscription1.defaults = ["blocking"]; |
let subscription2 = Subscription.fromURL("~exceptions"); |
- subscription2.defaults = ["whitelist", "elemhide"]; |
+ subscription2.defaults = ["whitelist", "elemhide", "snippet"]; |
let subscription3 = Subscription.fromURL("~other"); |
FilterStorage.addSubscription(subscription1); |
FilterStorage.addSubscription(subscription2); |
FilterStorage.addSubscription(subscription3); |
let changes = []; |
@@ -245,40 +245,45 @@ |
test.deepEqual(changes, ["filter.added foo##bar"], "Received changes"); |
changes = []; |
FilterStorage.addFilter(Filter.fromText("foo#@#bar")); |
compareFiltersList(test, "Adding hiding exception", [["foo"], ["@@bar", "foo##bar", "foo#@#bar"], []]); |
test.deepEqual(changes, ["filter.added foo#@#bar"], "Received changes"); |
changes = []; |
+ FilterStorage.addFilter(Filter.fromText("example.com#$#foo")); |
+ compareFiltersList(test, "Adding snippet script", [["foo"], ["@@bar", "foo##bar", "foo#@#bar", "example.com#$#foo"], []]); |
+ test.deepEqual(changes, ["filter.added example.com#$#foo"], "Received changes"); |
+ |
+ changes = []; |
FilterStorage.addFilter(Filter.fromText("!foobar")); |
- compareFiltersList(test, "Adding comment", [["foo"], ["@@bar", "foo##bar", "foo#@#bar"], ["!foobar"]]); |
+ compareFiltersList(test, "Adding comment", [["foo"], ["@@bar", "foo##bar", "foo#@#bar", "example.com#$#foo"], ["!foobar"]]); |
test.deepEqual(changes, ["filter.added !foobar"], "Received changes"); |
changes = []; |
FilterStorage.addFilter(Filter.fromText("foo")); |
- compareFiltersList(test, "Adding already added filter", [["foo"], ["@@bar", "foo##bar", "foo#@#bar"], ["!foobar"]]); |
+ compareFiltersList(test, "Adding already added filter", [["foo"], ["@@bar", "foo##bar", "foo#@#bar", "example.com#$#foo"], ["!foobar"]]); |
test.deepEqual(changes, [], "Received changes"); |
subscription1.disabled = true; |
changes = []; |
FilterStorage.addFilter(Filter.fromText("foo")); |
- compareFiltersList(test, "Adding filter already in a disabled subscription", [["foo"], ["@@bar", "foo##bar", "foo#@#bar"], ["!foobar", "foo"]]); |
+ compareFiltersList(test, "Adding filter already in a disabled subscription", [["foo"], ["@@bar", "foo##bar", "foo#@#bar", "example.com#$#foo"], ["!foobar", "foo"]]); |
test.deepEqual(changes, ["filter.added foo"], "Received changes"); |
changes = []; |
FilterStorage.addFilter(Filter.fromText("foo"), subscription1); |
- compareFiltersList(test, "Adding filter to an explicit subscription", [["foo", "foo"], ["@@bar", "foo##bar", "foo#@#bar"], ["!foobar", "foo"]]); |
+ compareFiltersList(test, "Adding filter to an explicit subscription", [["foo", "foo"], ["@@bar", "foo##bar", "foo#@#bar", "example.com#$#foo"], ["!foobar", "foo"]]); |
test.deepEqual(changes, ["filter.added foo"], "Received changes"); |
changes = []; |
FilterStorage.addFilter(Filter.fromText("!foobar"), subscription2, 0); |
- compareFiltersList(test, "Adding filter to an explicit subscription with position", [["foo", "foo"], ["!foobar", "@@bar", "foo##bar", "foo#@#bar"], ["!foobar", "foo"]]); |
+ compareFiltersList(test, "Adding filter to an explicit subscription with position", [["foo", "foo"], ["!foobar", "@@bar", "foo##bar", "foo#@#bar", "example.com#$#foo"], ["!foobar", "foo"]]); |
test.deepEqual(changes, ["filter.added !foobar"], "Received changes"); |
test.done(); |
}; |
exports.testRemovingFilters = function(test) |
{ |
let subscription1 = Subscription.fromURL("~foo"); |