| OLD | NEW |
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 callback(); | 57 callback(); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 function checkKnownFilters(test, text, expected) | 60 function checkKnownFilters(test, text, expected) |
| 61 { | 61 { |
| 62 let result = {}; | 62 let result = {}; |
| 63 for (let type of ["blacklist", "whitelist"]) | 63 for (let type of ["blacklist", "whitelist"]) |
| 64 { | 64 { |
| 65 let matcher = defaultMatcher[type]; | 65 let matcher = defaultMatcher[type]; |
| 66 let filters = []; | 66 let filters = []; |
| 67 for (let keyword in matcher.filterByKeyword) | 67 for (let [keyword, list] of matcher.filterByKeyword) |
| 68 { | 68 { |
| 69 let list = matcher.filterByKeyword[keyword]; | |
| 70 for (let i = 0; i < list.length; i++) | 69 for (let i = 0; i < list.length; i++) |
| 71 { | 70 { |
| 72 let filter = list[i]; | 71 let filter = list[i]; |
| 73 test.equal(matcher.getKeywordForFilter(filter), keyword, | 72 test.equal(matcher.getKeywordForFilter(filter), keyword, |
| 74 "Keyword of filter " + filter.text); | 73 "Keyword of filter " + filter.text); |
| 75 filters.push(filter.text); | 74 filters.push(filter.text); |
| 76 } | 75 } |
| 77 } | 76 } |
| 78 result[type] = filters; | 77 result[type] = filters; |
| 79 } | 78 } |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 checkKnownFilters(test, "disable exception rules", {blacklist: [filter1.text,
filter3.text], whitelist: [filter2.text]}); | 319 checkKnownFilters(test, "disable exception rules", {blacklist: [filter1.text,
filter3.text], whitelist: [filter2.text]}); |
| 321 | 320 |
| 322 FilterStorage.removeSubscription(subscription4); | 321 FilterStorage.removeSubscription(subscription4); |
| 323 checkKnownFilters(test, "remove subscription from the list", {blacklist: [filt
er1.text]}); | 322 checkKnownFilters(test, "remove subscription from the list", {blacklist: [filt
er1.text]}); |
| 324 | 323 |
| 325 subscription3.disabled = false; | 324 subscription3.disabled = false; |
| 326 checkKnownFilters(test, "enable exception rules", {blacklist: [filter1.text],
whitelist: [filter2.text]}); | 325 checkKnownFilters(test, "enable exception rules", {blacklist: [filter1.text],
whitelist: [filter2.text]}); |
| 327 | 326 |
| 328 test.done(); | 327 test.done(); |
| 329 }; | 328 }; |
| OLD | NEW |