LEFT | RIGHT |
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 29 matching lines...) Expand all Loading... |
40 return selectors.sort().filter((selector, index, sortedSelectors) => | 40 return selectors.sort().filter((selector, index, sortedSelectors) => |
41 { | 41 { |
42 return index == 0 || selector != sortedSelectors[index - 1]; | 42 return index == 0 || selector != sortedSelectors[index - 1]; |
43 }); | 43 }); |
44 } | 44 } |
45 | 45 |
46 function testResult(test, domain, expectedSelectors, criteria) | 46 function testResult(test, domain, expectedSelectors, criteria) |
47 { | 47 { |
48 let normalizedExpectedSelectors = normalizeSelectors(expectedSelectors); | 48 let normalizedExpectedSelectors = normalizeSelectors(expectedSelectors); |
49 | 49 |
50 // Test without filter keys | |
51 test.deepEqual( | 50 test.deepEqual( |
52 normalizeSelectors(ElemHide.getSelectorsForDomain(domain, criteria)), | 51 normalizeSelectors(ElemHide.getSelectorsForDomain(domain, criteria)), |
53 normalizedExpectedSelectors | 52 normalizedExpectedSelectors |
54 ); | 53 ); |
55 } | 54 } |
56 | 55 |
57 exports.testGetSelectorsForDomain = function(test) | 56 exports.testGetSelectorsForDomain = function(test) |
58 { | 57 { |
59 let addFilter = filterText => ElemHide.add(Filter.fromText(filterText)); | 58 let addFilter = filterText => ElemHide.add(Filter.fromText(filterText)); |
60 let removeFilter = filterText => ElemHide.remove(Filter.fromText(filterText)); | 59 let removeFilter = filterText => ElemHide.remove(Filter.fromText(filterText)); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 }; | 238 }; |
240 | 239 |
241 exports.testZeroFilterKey = function(test) | 240 exports.testZeroFilterKey = function(test) |
242 { | 241 { |
243 ElemHide.add(Filter.fromText("##test")); | 242 ElemHide.add(Filter.fromText("##test")); |
244 ElemHide.add(Filter.fromText("foo.com#@#test")); | 243 ElemHide.add(Filter.fromText("foo.com#@#test")); |
245 testResult(test, "foo.com", []); | 244 testResult(test, "foo.com", []); |
246 testResult(test, "bar.com", ["test"]); | 245 testResult(test, "bar.com", ["test"]); |
247 test.done(); | 246 test.done(); |
248 }; | 247 }; |
LEFT | RIGHT |