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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 function timeout(delay) | 20 function timeout(delay) |
21 { | 21 { |
22 return new Promise(resolve => | 22 return new Promise(resolve => |
23 { | 23 { |
24 setTimeout(resolve, delay); | 24 setTimeout(resolve, delay); |
25 }); | 25 }); |
26 } | 26 } |
27 | 27 |
28 exports.timeout = timeout; | 28 exports.timeout = timeout; |
| 29 |
| 30 function expectHidden(test, element, id) |
| 31 { |
| 32 let withId = ""; |
| 33 if (typeof id != "undefined") |
| 34 withId = ` with ID '${id}'`; |
| 35 |
| 36 test.equal( |
| 37 window.getComputedStyle(element).display, "none", |
| 38 `The element${withId}'s display property should be set to 'none'`); |
| 39 } |
| 40 |
| 41 exports.expectHidden = expectHidden; |
| 42 |
| 43 function expectVisible(test, element, id) |
| 44 { |
| 45 let withId = ""; |
| 46 if (typeof id != "undefined") |
| 47 withId = ` with ID '${id}'`; |
| 48 |
| 49 test.notEqual( |
| 50 window.getComputedStyle(element).display, "none", |
| 51 `The element${withId}'s display property should not be set to 'none'`); |
| 52 } |
| 53 |
| 54 exports.expectVisible = expectVisible; |
OLD | NEW |