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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 ); | 111 ); |
112 | 112 |
113 elemHideEmulation.apply(); | 113 elemHideEmulation.apply(); |
114 return Promise.resolve(); | 114 return Promise.resolve(); |
115 } | 115 } |
116 | 116 |
117 exports.testVerbatimPropertySelector = function(test) | 117 exports.testVerbatimPropertySelector = function(test) |
118 { | 118 { |
119 let toHide = createElementWithStyle("{background-color: #000}"); | 119 let toHide = createElementWithStyle("{background-color: #000}"); |
120 applyElemHideEmulation( | 120 applyElemHideEmulation( |
121 ["[-abp-properties='background-color: rgb(0, 0, 0)']"] | 121 [":-abp-properties(background-color: rgb(0, 0, 0))"] |
122 ).then(() => | 122 ).then(() => |
123 { | 123 { |
124 expectHidden(test, toHide); | 124 expectHidden(test, toHide); |
125 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 125 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
126 }; | 126 }; |
127 | 127 |
128 exports.testPropertySelectorWithWildcard = function(test) | 128 exports.testPropertySelectorWithWildcard = function(test) |
129 { | 129 { |
130 let toHide = createElementWithStyle("{background-color: #000}"); | 130 let toHide = createElementWithStyle("{background-color: #000}"); |
131 applyElemHideEmulation( | 131 applyElemHideEmulation( |
132 ["[-abp-properties='*color: rgb(0, 0, 0)']"] | 132 [":-abp-properties(*color: rgb(0, 0, 0))"] |
133 ).then(() => | 133 ).then(() => |
134 { | 134 { |
135 expectHidden(test, toHide); | 135 expectHidden(test, toHide); |
136 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 136 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
137 }; | 137 }; |
138 | 138 |
139 exports.testPropertySelectorWithRegularExpression = function(test) | 139 exports.testPropertySelectorWithRegularExpression = function(test) |
140 { | 140 { |
141 let toHide = createElementWithStyle("{background-color: #000}"); | 141 let toHide = createElementWithStyle("{background-color: #000}"); |
142 applyElemHideEmulation( | 142 applyElemHideEmulation( |
143 ["[-abp-properties='/.*color: rgb\\(0, 0, 0\\)/']"] | 143 [":-abp-properties(/.*color: rgb\\(0, 0, 0\\)/)"] |
144 ).then(() => | 144 ).then(() => |
145 { | 145 { |
146 expectHidden(test, toHide); | 146 expectHidden(test, toHide); |
147 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 147 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
148 }; | 148 }; |
149 | 149 |
150 exports.testPropertySelectorWithEscapedBrace = function(test) | 150 exports.testPropertySelectorWithEscapedBrace = function(test) |
151 { | 151 { |
152 let toHide = createElementWithStyle("{background-color: #000}"); | 152 let toHide = createElementWithStyle("{background-color: #000}"); |
153 applyElemHideEmulation( | 153 applyElemHideEmulation( |
154 ["[-abp-properties='/background.\\x7B 0,6\\x7D : rgb\\(0, 0, 0\\)/']"] | 154 [":-abp-properties(/background.\\x7B 0,6\\x7D : rgb\\(0, 0, 0\\)/)"] |
155 ).then(() => | 155 ).then(() => |
156 { | 156 { |
157 expectHidden(test, toHide); | 157 expectHidden(test, toHide); |
158 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 158 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
159 }; | 159 }; |
160 | 160 |
161 exports.testPropertySelectorWithImproperlyEscapedBrace = function(test) | 161 exports.testPropertySelectorWithImproperlyEscapedBrace = function(test) |
162 { | 162 { |
163 let toHide = createElementWithStyle("{background-color: #000}"); | 163 let toHide = createElementWithStyle("{background-color: #000}"); |
164 applyElemHideEmulation( | 164 applyElemHideEmulation( |
165 ["[-abp-properties='/background.\\x7B0,6\\x7D: rgb\\(0, 0, 0\\)/']"] | 165 [":-abp-properties(/background.\\x7B0,6\\x7D: rgb\\(0, 0, 0\\)/)"] |
166 ).then(() => | 166 ).then(() => |
167 { | 167 { |
168 expectVisible(test, toHide); | 168 expectVisible(test, toHide); |
169 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 169 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
170 }; | 170 }; |
171 | 171 |
172 exports.testDynamicallyChangedProperty = function(test) | 172 exports.testDynamicallyChangedProperty = function(test) |
173 { | 173 { |
174 let toHide = createElementWithStyle("{}"); | 174 let toHide = createElementWithStyle("{}"); |
175 applyElemHideEmulation( | 175 applyElemHideEmulation( |
176 ["[-abp-properties='background-color: rgb(0, 0, 0)']"] | 176 [":-abp-properties(background-color: rgb(0, 0, 0))"] |
177 ).then(() => | 177 ).then(() => |
178 { | 178 { |
179 expectVisible(test, toHide); | 179 expectVisible(test, toHide); |
180 insertStyleRule("#" + toHide.id + " {background-color: #000}"); | 180 insertStyleRule("#" + toHide.id + " {background-color: #000}"); |
181 return new Promise((resolve, reject) => | 181 return new Promise((resolve, reject) => |
182 { | 182 { |
183 window.setTimeout(() => | 183 window.setTimeout(() => |
184 { | 184 { |
185 expectHidden(test, toHide); | 185 expectHidden(test, toHide); |
186 resolve(); | 186 resolve(); |
187 }, 0); | 187 }, 0); |
188 }); | 188 }); |
189 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 189 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
190 }; | 190 }; |
OLD | NEW |