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

Unified Diff: test/subscriptionClasses.js

Issue 30013628: Issue 7029 - Remove subscriptions property of Filter object (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Feb. 24, 2019, 1:30 p.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
« test/filterStorage_readwrite.js ('K') | « test/filterStorage_readwrite.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/subscriptionClasses.js
===================================================================
--- a/test/subscriptionClasses.js
+++ b/test/subscriptionClasses.js
@@ -136,82 +136,82 @@
exports.testFilterManagement = function(test)
{
let subscription = Subscription.fromURL("https://example.com/");
compareSubscriptionFilters(test, subscription, []);
subscription.addFilter(f$("##.foo"));
compareSubscriptionFilters(test, subscription, ["##.foo"]);
- test.equal(subscription.searchFilter(f$("##.foo")), 0);
+ test.equal(subscription.findFilterIndex(f$("##.foo")), 0);
subscription.addFilter(f$("##.bar"));
compareSubscriptionFilters(test, subscription, ["##.foo", "##.bar"]);
- test.equal(subscription.searchFilter(f$("##.bar")), 1);
+ test.equal(subscription.findFilterIndex(f$("##.bar")), 1);
// Repeat filter.
subscription.addFilter(f$("##.bar"));
compareSubscriptionFilters(test, subscription, ["##.foo", "##.bar",
"##.bar"]);
// The first occurrence is found.
- test.equal(subscription.searchFilter(f$("##.bar")), 1);
+ test.equal(subscription.findFilterIndex(f$("##.bar")), 1);
subscription.deleteFilterAt(0);
compareSubscriptionFilters(test, subscription, ["##.bar", "##.bar"]);
- test.equal(subscription.searchFilter(f$("##.bar")), 0);
+ test.equal(subscription.findFilterIndex(f$("##.bar")), 0);
subscription.insertFilterAt(f$("##.foo"), 0);
compareSubscriptionFilters(test, subscription, ["##.foo", "##.bar",
"##.bar"]);
- test.equal(subscription.searchFilter(f$("##.bar")), 1);
+ test.equal(subscription.findFilterIndex(f$("##.bar")), 1);
subscription.deleteFilterAt(1);
compareSubscriptionFilters(test, subscription, ["##.foo", "##.bar"]);
- test.equal(subscription.searchFilter(f$("##.bar")), 1);
+ test.equal(subscription.findFilterIndex(f$("##.bar")), 1);
subscription.deleteFilterAt(1);
compareSubscriptionFilters(test, subscription, ["##.foo"]);
- test.equal(subscription.searchFilter(f$("##.bar")), -1);
+ test.equal(subscription.findFilterIndex(f$("##.bar")), -1);
subscription.addFilter(f$("##.bar"));
compareSubscriptionFilters(test, subscription, ["##.foo", "##.bar"]);
- test.equal(subscription.searchFilter(f$("##.bar")), 1);
+ test.equal(subscription.findFilterIndex(f$("##.bar")), 1);
subscription.clearFilters();
compareSubscriptionFilters(test, subscription, []);
- test.equal(subscription.searchFilter(f$("##.foo")), -1);
- test.equal(subscription.searchFilter(f$("##.bar")), -1);
+ test.equal(subscription.findFilterIndex(f$("##.foo")), -1);
+ test.equal(subscription.findFilterIndex(f$("##.bar")), -1);
subscription.addFilter(f$("##.bar"));
compareSubscriptionFilters(test, subscription, ["##.bar"]);
subscription.addFilter(f$("##.foo"));
compareSubscriptionFilters(test, subscription, ["##.bar", "##.foo"]);
- test.equal(subscription.searchFilter(f$("##.bar")), 0);
- test.equal(subscription.searchFilter(f$("##.foo")), 1);
+ test.equal(subscription.findFilterIndex(f$("##.bar")), 0);
+ test.equal(subscription.findFilterIndex(f$("##.foo")), 1);
// Insert outside of bounds.
subscription.insertFilterAt(f$("##.lambda"), 1000);
compareSubscriptionFilters(test, subscription, ["##.bar", "##.foo",
"##.lambda"]);
- test.equal(subscription.searchFilter(f$("##.lambda")), 2);
+ test.equal(subscription.findFilterIndex(f$("##.lambda")), 2);
// Delete outside of bounds.
subscription.deleteFilterAt(1000);
compareSubscriptionFilters(test, subscription, ["##.bar", "##.foo",
"##.lambda"]);
- test.equal(subscription.searchFilter(f$("##.lambda")), 2);
+ test.equal(subscription.findFilterIndex(f$("##.lambda")), 2);
// Insert outside of bounds (negative).
subscription.insertFilterAt(f$("##.lambda"), -1000);
compareSubscriptionFilters(test, subscription, ["##.lambda", "##.bar",
"##.foo", "##.lambda"]);
- test.equal(subscription.searchFilter(f$("##.lambda")), 0);
+ test.equal(subscription.findFilterIndex(f$("##.lambda")), 0);
// Delete outside of bounds (negative).
subscription.deleteFilterAt(-1000);
compareSubscriptionFilters(test, subscription, ["##.lambda", "##.bar",
"##.foo", "##.lambda"]);
- test.equal(subscription.searchFilter(f$("##.lambda")), 0);
+ test.equal(subscription.findFilterIndex(f$("##.lambda")), 0);
test.done();
};
« test/filterStorage_readwrite.js ('K') | « test/filterStorage_readwrite.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld