| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 { | 254 { |
| 255 let toHide = createElementWithStyle("{}"); | 255 let toHide = createElementWithStyle("{}"); |
| 256 applyElemHideEmulation( | 256 applyElemHideEmulation( |
| 257 [":-abp-properties(background-color: rgb(0, 0, 0))"] | 257 [":-abp-properties(background-color: rgb(0, 0, 0))"] |
| 258 ).then(() => | 258 ).then(() => |
| 259 { | 259 { |
| 260 expectVisible(test, toHide); | 260 expectVisible(test, toHide); |
| 261 insertStyleRule("#" + toHide.id + " {background-color: #000}"); | 261 insertStyleRule("#" + toHide.id + " {background-color: #000}"); |
| 262 return new Promise((resolve, reject) => | 262 return new Promise((resolve, reject) => |
| 263 { | 263 { |
| 264 // Re-evaluation will only happen after a few seconds |
| 265 expectVisible(test, toHide); |
| 264 window.setTimeout(() => | 266 window.setTimeout(() => |
| 265 { | 267 { |
| 266 expectHidden(test, toHide); | 268 expectHidden(test, toHide); |
| 267 resolve(); | 269 resolve(); |
| 268 }, 0); | 270 }, 4000); |
| 269 }); | 271 }); |
| 270 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 272 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
| 271 }; | 273 }; |
| 272 | 274 |
| 273 exports.testPseudoClassHasSelector = function(test) | 275 exports.testPseudoClassHasSelector = function(test) |
| 274 { | 276 { |
| 275 let toHide = createElementWithStyle("{}"); | 277 let toHide = createElementWithStyle("{}"); |
| 276 applyElemHideEmulation( | 278 applyElemHideEmulation( |
| 277 ["div:-abp-has(div)"] | 279 ["div:-abp-has(div)"] |
| 278 ).then(() => | 280 ).then(() => |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 let parent = createElementWithStyle("{}"); | 399 let parent = createElementWithStyle("{}"); |
| 398 let child = createElementWithStyle("{background-color: #000}", parent); | 400 let child = createElementWithStyle("{background-color: #000}", parent); |
| 399 applyElemHideEmulation( | 401 applyElemHideEmulation( |
| 400 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"] | 402 ["div:-abp-has(:-abp-properties(background-color: rgb(0, 0, 0)))"] |
| 401 ).then(() => | 403 ).then(() => |
| 402 { | 404 { |
| 403 expectVisible(test, child); | 405 expectVisible(test, child); |
| 404 expectHidden(test, parent); | 406 expectHidden(test, parent); |
| 405 }).catch(unexpectedError.bind(test)).then(() => test.done()); | 407 }).catch(unexpectedError.bind(test)).then(() => test.done()); |
| 406 }; | 408 }; |
| OLD | NEW |