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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 test.equal(filtersByDomain.size, 2); | 266 test.equal(filtersByDomain.size, 2); |
267 | 267 |
268 ElemHide.remove(Filter.fromText("example.com##test")); | 268 ElemHide.remove(Filter.fromText("example.com##test")); |
269 test.equal(filtersByDomain.size, 2); | 269 test.equal(filtersByDomain.size, 2); |
270 | 270 |
271 ElemHide.remove(Filter.fromText("example.com,~www.example.com##test")); | 271 ElemHide.remove(Filter.fromText("example.com,~www.example.com##test")); |
272 test.equal(filtersByDomain.size, 0); | 272 test.equal(filtersByDomain.size, 0); |
273 | 273 |
274 test.done(); | 274 test.done(); |
275 }; | 275 }; |
| 276 |
| 277 exports.testGenericSelectorDedup = function(test) |
| 278 { |
| 279 ElemHide.add(Filter.fromText("##test1")); |
| 280 ElemHide.add(Filter.fromText("##test2")); |
| 281 ElemHide.add(Filter.fromText("##test3")); |
| 282 |
| 283 test.equal(ElemHide.getSelectorsForDomain("foo.example.com"), |
| 284 ElemHide.getSelectorsForDomain("bar.example.com")); |
| 285 |
| 286 ElemHide.add(Filter.fromText("foo.example.com##test4")); |
| 287 |
| 288 test.notEqual(ElemHide.getSelectorsForDomain("foo.example.com"), |
| 289 ElemHide.getSelectorsForDomain("bar.example.com")); |
| 290 |
| 291 ElemHide.remove(Filter.fromText("foo.example.com##test4")); |
| 292 |
| 293 test.equal(ElemHide.getSelectorsForDomain("foo.example.com"), |
| 294 ElemHide.getSelectorsForDomain("bar.example.com")); |
| 295 |
| 296 ElemHide.remove(Filter.fromText("##test1")); |
| 297 ElemHide.remove(Filter.fromText("##test2")); |
| 298 ElemHide.remove(Filter.fromText("##test3")); |
| 299 |
| 300 test.equal(ElemHide.getSelectorsForDomain("foo.example.com"), |
| 301 ElemHide.getSelectorsForDomain("bar.example.com")); |
| 302 |
| 303 test.done(); |
| 304 }; |
OLD | NEW |