| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 228 } |
| 229 | 229 |
| 230 test.done(); | 230 test.done(); |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 exports.testSerialize = function(test) | 233 exports.testSerialize = function(test) |
| 234 { | 234 { |
| 235 // Comment | 235 // Comment |
| 236 let filter = Filter.fromText("! serialize"); | 236 let filter = Filter.fromText("! serialize"); |
| 237 test.equal(filter.serialize(), "[Filter]\ntext=! serialize\n"); | 237 test.equal(filter.serialize(), "[Filter]\ntext=! serialize\n"); |
| 238 test.equal(filter.collapse, undefined); |
| 238 filter.delete(); | 239 filter.delete(); |
| 239 | 240 |
| 240 // Blocking filter | 241 // Blocking filter |
| 241 filter = Filter.fromText("serialize"); | 242 filter = Filter.fromText("serialize"); |
| 242 test.equal(filter.serialize(), "[Filter]\ntext=serialize\n"); | 243 test.equal(filter.serialize(), "[Filter]\ntext=serialize\n"); |
| 243 filter.disabled = true; | 244 filter.disabled = true; |
| 244 test.equal(filter.serialize(), "[Filter]\ntext=serialize\ndisabled=true\n"); | 245 test.equal(filter.serialize(), "[Filter]\ntext=serialize\ndisabled=true\n"); |
| 245 filter.disabled = false; | 246 filter.disabled = false; |
| 246 filter.hitCount = 10; | 247 filter.hitCount = 10; |
| 247 filter.lastHit = 12; | 248 filter.lastHit = 12; |
| 248 test.equal(filter.serialize(), "[Filter]\ntext=serialize\nhitCount=10\nlastHit
=12\n"); | 249 test.equal(filter.serialize(), "[Filter]\ntext=serialize\nhitCount=10\nlastHit
=12\n"); |
| 250 test.ok(filter.collapse); |
| 249 filter.delete(); | 251 filter.delete(); |
| 250 | 252 |
| 251 // Invalid filter | 253 // Invalid filter |
| 252 filter = Filter.fromText("serialize$foobar"); | 254 filter = Filter.fromText("serialize$foobar"); |
| 253 test.equal(filter.serialize(), "[Filter]\ntext=serialize$foobar\n"); | 255 test.equal(filter.serialize(), "[Filter]\ntext=serialize$foobar\n"); |
| 254 filter.delete(); | 256 filter.delete(); |
| 255 | 257 |
| 256 // Element hiding filter | 258 // Element hiding filter |
| 257 filter = Filter.fromText("example.com##serialize"); | 259 filter = Filter.fromText("example.com##serialize"); |
| 258 test.equal(filter.serialize(), "[Filter]\ntext=example.com##serialize\n"); | 260 test.equal(filter.serialize(), "[Filter]\ntext=example.com##serialize\n"); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 filter.hitCount++; | 431 filter.hitCount++; |
| 430 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts"); | 432 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts"); |
| 431 checkNotifications(() => | 433 checkNotifications(() => |
| 432 { | 434 { |
| 433 filter.hitCount = 0; | 435 filter.hitCount = 0; |
| 434 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts"); | 436 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts"); |
| 435 | 437 |
| 436 filter.delete(); | 438 filter.delete(); |
| 437 test.done(); | 439 test.done(); |
| 438 }; | 440 }; |
| OLD | NEW |