| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  105       test.equal(filter.type, typeName, "Type name for " + text + " is " + typeN
     ame); |  105       test.equal(filter.type, typeName, "Type name for " + text + " is " + typeN
     ame); | 
|  106       if (filter instanceof BlockingFilter) |  106       if (filter instanceof BlockingFilter) | 
|  107         test.equal(filter.collapse, collapse); |  107         test.equal(filter.collapse, collapse); | 
|  108       else |  108       else | 
|  109         test.equal(filter.collapse, undefined); |  109         test.equal(filter.collapse, undefined); | 
|  110       if (type == InvalidFilter) |  110       if (type == InvalidFilter) | 
|  111         test.ok(filter.reason, "Invalid filter " + text + " has a reason set"); |  111         test.ok(filter.reason, "Invalid filter " + text + " has a reason set"); | 
|  112     })(Filter.fromText(text)); |  112     })(Filter.fromText(text)); | 
|  113   } |  113   } | 
|  114  |  114  | 
|  115   // conversion from old syntax. |  | 
|  116   withNAD(0, filter => |  | 
|  117   { |  | 
|  118     test.equal(filter.text, "example.com#?#:-abp-properties(something)"); |  | 
|  119     test.ok(filter instanceof ElemHideEmulationFilter); |  | 
|  120     test.equal(filter.type, "elemhideemulation"); |  | 
|  121   })(Filter.fromText("example.com##[-abp-properties='something']")); |  | 
|  122  |  | 
|  123   test.done(); |  115   test.done(); | 
|  124 }; |  116 }; | 
|  125  |  117  | 
|  126 exports.testClassHierarchy = function(test) |  118 exports.testClassHierarchy = function(test) | 
|  127 { |  119 { | 
|  128   let allClasses = [ |  120   let allClasses = [ | 
|  129     Filter, InvalidFilter, CommentFilter, ActiveFilter, |  121     Filter, InvalidFilter, CommentFilter, ActiveFilter, | 
|  130     RegExpFilter, BlockingFilter, WhitelistFilter, ElemHideBase, |  122     RegExpFilter, BlockingFilter, WhitelistFilter, ElemHideBase, | 
|  131     ElemHideFilter, ElemHideException, ElemHideEmulationFilter |  123     ElemHideFilter, ElemHideException, ElemHideEmulationFilter | 
|  132   ]; |  124   ]; | 
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  397 }; |  389 }; | 
|  398  |  390  | 
|  399 exports.testElemHideRulesWithBraces = function(test) |  391 exports.testElemHideRulesWithBraces = function(test) | 
|  400 { |  392 { | 
|  401   withNAD(0, filter => |  393   withNAD(0, filter => | 
|  402   { |  394   { | 
|  403     test.equal(filter.type, "elemhide"); |  395     test.equal(filter.type, "elemhide"); | 
|  404     test.equal(filter.selector, "#foo\\7B color: red\\7D "); |  396     test.equal(filter.selector, "#foo\\7B color: red\\7D "); | 
|  405   })(Filter.fromText("###foo{color: red}")); |  397   })(Filter.fromText("###foo{color: red}")); | 
|  406  |  398  | 
|  407   // Filter conversion to the new syntax dealing with braces too. |  | 
|  408   withNAD(0, filter => |  | 
|  409   { |  | 
|  410     test.equal(filter.type, "elemhideemulation"); |  | 
|  411     test.equal(filter.selector, ":-abp-properties(/margin: [3-4]\\7B 2\\7D /)"); |  | 
|  412   })(Filter.fromText("foo.com##[-abp-properties='/margin: [3-4]{2}/']")); |  | 
|  413  |  | 
|  414   test.done(); |  399   test.done(); | 
|  415 }; |  400 }; | 
|  416  |  401  | 
|  417 exports.testNotifications = function(test) |  402 exports.testNotifications = function(test) | 
|  418 { |  403 { | 
|  419   function checkNotifications(action, expected, message) |  404   function checkNotifications(action, expected, message) | 
|  420   { |  405   { | 
|  421     let result = null; |  406     let result = null; | 
|  422     let listener = (topic, filter) => |  407     let listener = (topic, filter) => | 
|  423     { |  408     { | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  479    "foo.com,,bar.com##selector", "foo.com,~,bar.com##selector"] |  464    "foo.com,,bar.com##selector", "foo.com,~,bar.com##selector"] | 
|  480     .map(filterText => Filter.fromText(filterText)) |  465     .map(filterText => Filter.fromText(filterText)) | 
|  481     .forEach(withNAD(0, filter => |  466     .forEach(withNAD(0, filter => | 
|  482     { |  467     { | 
|  483       test.ok(filter instanceof InvalidFilter); |  468       test.ok(filter instanceof InvalidFilter); | 
|  484       test.equal(filter.reason, "filter_invalid_domain"); |  469       test.equal(filter.reason, "filter_invalid_domain"); | 
|  485     })); |  470     })); | 
|  486  |  471  | 
|  487   test.done(); |  472   test.done(); | 
|  488 }; |  473 }; | 
| OLD | NEW |