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

Side by Side Diff: test/subscriptionClasses.js

Issue 29946572: Issue 7094 - Keep subscription filters by text only (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Fix bug Created Nov. 19, 2018, 2:28 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« lib/filterListener.js ('K') | « test/filterStorage.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (/(.*?)=(.*)/.test(line)) 58 if (/(.*?)=(.*)/.test(line))
59 map[RegExp.$1] = RegExp.$2; 59 map[RegExp.$1] = RegExp.$2;
60 } 60 }
61 let subscription2 = Subscription.fromObject(map); 61 let subscription2 = Subscription.fromObject(map);
62 test.equal(subscription.toString(), subscription2.toString(), url + " deserial ization"); 62 test.equal(subscription.toString(), subscription2.toString(), url + " deserial ization");
63 } 63 }
64 64
65 function compareSubscriptionFilters(test, subscription, expected) 65 function compareSubscriptionFilters(test, subscription, expected)
66 { 66 {
67 test.deepEqual([...subscription.filterText()], expected); 67 test.deepEqual([...subscription.filterText()], expected);
68 test.deepEqual([...subscription.filters()], expected.map(f$));
69 68
70 test.equal(subscription.filterCount, expected.length); 69 test.equal(subscription.filterCount, expected.length);
71 70
72 for (let i = 0; i < subscription.filterCount; i++) 71 for (let i = 0; i < subscription.filterCount; i++)
73 test.equal(subscription.filterAt(i).text, expected[i]); 72 test.equal(subscription.filterTextAt(i), expected[i]);
74 73
75 test.ok(!subscription.filterAt(subscription.filterCount)); 74 test.ok(!subscription.filterTextAt(subscription.filterCount));
76 test.ok(!subscription.filterAt(-1)); 75 test.ok(!subscription.filterTextAt(-1));
77 } 76 }
78 77
79 exports.testSubscriptionClassDefinitions = function(test) 78 exports.testSubscriptionClassDefinitions = function(test)
80 { 79 {
81 test.equal(typeof Subscription, "function", "typeof Subscription"); 80 test.equal(typeof Subscription, "function", "typeof Subscription");
82 test.equal(typeof SpecialSubscription, "function", "typeof SpecialSubscription "); 81 test.equal(typeof SpecialSubscription, "function", "typeof SpecialSubscription ");
83 test.equal(typeof RegularSubscription, "function", "typeof RegularSubscription "); 82 test.equal(typeof RegularSubscription, "function", "typeof RegularSubscription ");
84 test.equal(typeof ExternalSubscription, "function", "typeof ExternalSubscripti on"); 83 test.equal(typeof ExternalSubscription, "function", "typeof ExternalSubscripti on");
85 test.equal(typeof DownloadableSubscription, "function", "typeof DownloadableSu bscription"); 84 test.equal(typeof DownloadableSubscription, "function", "typeof DownloadableSu bscription");
86 85
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 test.equal(subscription.searchFilter(f$("##.lambda")), 0); 208 test.equal(subscription.searchFilter(f$("##.lambda")), 0);
210 209
211 // Delete outside of bounds (negative). 210 // Delete outside of bounds (negative).
212 subscription.deleteFilterAt(-1000); 211 subscription.deleteFilterAt(-1000);
213 compareSubscriptionFilters(test, subscription, ["##.lambda", "##.bar", 212 compareSubscriptionFilters(test, subscription, ["##.lambda", "##.bar",
214 "##.foo", "##.lambda"]); 213 "##.foo", "##.lambda"]);
215 test.equal(subscription.searchFilter(f$("##.lambda")), 0); 214 test.equal(subscription.searchFilter(f$("##.lambda")), 0);
216 215
217 test.done(); 216 test.done();
218 }; 217 };
OLDNEW
« lib/filterListener.js ('K') | « test/filterStorage.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld