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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 .map(filter => filter.text); | 54 .map(filter => filter.text); |
55 test.deepEqual(matches.sort(), expectedMatches.sort(), description); | 55 test.deepEqual(matches.sort(), expectedMatches.sort(), description); |
56 | 56 |
57 ElemHideEmulation.clear(); | 57 ElemHideEmulation.clear(); |
58 ElemHide.clear(); | 58 ElemHide.clear(); |
59 } | 59 } |
60 | 60 |
61 testSelectorMatches( | 61 testSelectorMatches( |
62 "Ignore generic filters", | 62 "Ignore generic filters", |
63 [ | 63 [ |
64 "##[-abp-properties='foo']", "example.com##[-abp-properties='foo']", | 64 "#?#:-abp-properties(foo)", "example.com#?#:-abp-properties(foo)", |
65 "~example.com##[-abp-properties='foo']" | 65 "~example.com#?#:-abp-properties(foo)" |
66 ], | 66 ], |
67 "example.com", | 67 "example.com", |
68 ["example.com##[-abp-properties='foo']"] | 68 ["example.com#?#:-abp-properties(foo)"] |
69 ); | 69 ); |
70 testSelectorMatches( | 70 testSelectorMatches( |
71 "Ignore selectors with exceptions", | 71 "Ignore selectors with exceptions", |
72 [ | 72 [ |
73 "example.com##[-abp-properties='foo']", | 73 "example.com#?#:-abp-properties(foo)", |
74 "example.com##[-abp-properties='bar']", | 74 "example.com#?#:-abp-properties(bar)", |
75 "example.com#@#[-abp-properties='foo']" | 75 "example.com#@#:-abp-properties(foo)" |
76 ], | 76 ], |
77 "example.com", | 77 "example.com", |
78 ["example.com##[-abp-properties='bar']"] | 78 ["example.com#?#:-abp-properties(bar)"] |
79 ); | 79 ); |
80 testSelectorMatches( | 80 testSelectorMatches( |
81 "Ignore filters that include parent domain but exclude subdomain", | 81 "Ignore filters that include parent domain but exclude subdomain", |
82 [ | 82 [ |
83 "~www.example.com,example.com##[-abp-properties='foo']" | 83 "~www.example.com,example.com#?#:-abp-properties(foo)" |
84 ], | 84 ], |
85 "www.example.com", | 85 "www.example.com", |
86 [] | 86 [] |
87 ); | 87 ); |
88 testSelectorMatches( | 88 testSelectorMatches( |
89 "Ignore filters with parent domain if exception matches subdomain", | 89 "Ignore filters with parent domain if exception matches subdomain", |
90 [ | 90 [ |
91 "www.example.com#@#[-abp-properties='foo']", | 91 "www.example.com#@#:-abp-properties(foo)", |
92 "example.com##[-abp-properties='foo']" | 92 "example.com#?#:-abp-properties(foo)" |
93 ], | 93 ], |
94 "www.example.com", | 94 "www.example.com", |
95 [] | 95 [] |
96 ); | 96 ); |
97 testSelectorMatches( | 97 testSelectorMatches( |
98 "Ignore filters for other subdomain", | 98 "Ignore filters for other subdomain", |
99 [ | 99 [ |
100 "www.example.com##[-abp-properties='foo']", | 100 "www.example.com#?#:-abp-properties(foo)", |
101 "other.example.com##[-abp-properties='foo']" | 101 "other.example.com#?#:-abp-properties(foo)" |
102 ], | 102 ], |
103 "other.example.com", | 103 "other.example.com", |
104 ["other.example.com##[-abp-properties='foo']"] | 104 ["other.example.com#?#:-abp-properties(foo)"] |
105 ); | 105 ); |
106 | 106 |
107 test.done(); | 107 test.done(); |
108 }; | 108 }; |
109 | 109 |
110 exports.testElemHideEmulationFiltersContainer = function(test) | 110 exports.testElemHideEmulationFiltersContainer = function(test) |
111 { | 111 { |
112 function compareRules(description, domain, expectedMatches) | 112 function compareRules(description, domain, expectedMatches) |
113 { | 113 { |
114 let result = ElemHideEmulation.getRulesForDomain(domain) | 114 let result = ElemHideEmulation.getRulesForDomain(domain) |
(...skipping 24 matching lines...) Expand all Loading... |
139 | 139 |
140 ElemHideEmulation.clear(); | 140 ElemHideEmulation.clear(); |
141 compareRules( | 141 compareRules( |
142 "Return no filters after clearing", | 142 "Return no filters after clearing", |
143 "www.example.com", | 143 "www.example.com", |
144 [] | 144 [] |
145 ); | 145 ); |
146 | 146 |
147 test.done(); | 147 test.done(); |
148 }; | 148 }; |
OLD | NEW |