| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 test.done(); | 345 test.done(); |
| 346 }; | 346 }; |
| 347 | 347 |
| 348 exports.testElemHideSelector = function(test) | 348 exports.testElemHideSelector = function(test) |
| 349 { | 349 { |
| 350 function doTest(text, selector, selectorDomain) | 350 function doTest(text, selector, selectorDomain) |
| 351 { | 351 { |
| 352 let filter = Filter.fromText(text); | 352 let filter = Filter.fromText(text); |
| 353 test.equal(filter.selector, selector, "Correct selector for " + text); | 353 test.equal(filter.selector, selector, "Correct selector for " + text); |
| 354 |
| 354 let actualDomains = filter.selectorDomain.split(",").sort().join(","); | 355 let actualDomains = filter.selectorDomain.split(",").sort().join(","); |
| 355 let expectedDomains = selectorDomain.split(",").sort().join(","); | 356 let expectedDomains = selectorDomain.split(",").sort().join(","); |
| 356 test.equal(actualDomains, expectedDomains, "Correct domains list for " + tex
t); | 357 test.equal(actualDomains, expectedDomains, "Correct domains list for " + tex
t); |
| 357 | 358 |
| 358 filter.delete(); | 359 filter.delete(); |
| 359 } | 360 } |
| 360 | 361 |
| 361 let tests = [ | 362 let tests = [ |
| 362 ["##foobar", "foobar", ""], | 363 ["##foobar", "foobar", ""], |
| 363 ["~example.com##foobar", "foobar", ""], | 364 ["~example.com##foobar", "foobar", ""], |
| (...skipping 13 matching lines...) Expand all Loading... |
| 377 doTest(text.replace("##", "#@#"), selector, selectorDomain); | 378 doTest(text.replace("##", "#@#"), selector, selectorDomain); |
| 378 } | 379 } |
| 379 | 380 |
| 380 test.done(); | 381 test.done(); |
| 381 }; | 382 }; |
| 382 | 383 |
| 383 exports.testElemHideRulesWithBraces = function(test) | 384 exports.testElemHideRulesWithBraces = function(test) |
| 384 { | 385 { |
| 385 let filter = Filter.fromText("###foo{color: red}"); | 386 let filter = Filter.fromText("###foo{color: red}"); |
| 386 test.equal(filter.type, "elemhide"); | 387 test.equal(filter.type, "elemhide"); |
| 387 test.equal(filter.selector, "#foo\\x7B color: red\\x7D "); | 388 test.equal(filter.selector, "#foo\\7B color: red\\7D "); |
| 389 filter.delete(); |
| 390 |
| 391 filter = Filter.fromText("foo.com##[-abp-properties='/margin: [3-4]{2}/']"); |
| 392 test.equal(filter.type, "elemhideemulation"); |
| 393 test.equal(filter.selector, "[-abp-properties='/margin: [3-4]\\7B 2\\7D /']"); |
| 388 filter.delete(); | 394 filter.delete(); |
| 389 | 395 |
| 390 test.done(); | 396 test.done(); |
| 391 }; | 397 }; |
| 392 | 398 |
| 393 exports.testNotifications = function(test) | 399 exports.testNotifications = function(test) |
| 394 { | 400 { |
| 395 function checkNotifications(action, expected, message) | 401 function checkNotifications(action, expected, message) |
| 396 { | 402 { |
| 397 let result = null; | 403 let result = null; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 filter.hitCount++; | 446 filter.hitCount++; |
| 441 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts"); | 447 }, ["filter.hitCount", "foobar"], "Increasing filter hit counts"); |
| 442 checkNotifications(() => | 448 checkNotifications(() => |
| 443 { | 449 { |
| 444 filter.hitCount = 0; | 450 filter.hitCount = 0; |
| 445 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts"); | 451 }, ["filter.hitCount", "foobar"], "Resetting filter hit counts"); |
| 446 | 452 |
| 447 filter.delete(); | 453 filter.delete(); |
| 448 test.done(); | 454 test.done(); |
| 449 }; | 455 }; |
| LEFT | RIGHT |