Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: test/browser/_utils.js

Issue 30024560: Issue 7450 - Implement hide-if-contains-visible-text snippet (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Snippet is now type 1 Created April 18, 2019, 2:47 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 {
Manish Jethani 2019/04/18 08:40:43 I really don't think this is generic enough to kee
hub 2019/04/18 17:48:40 Done.
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;
OLDNEW

Powered by Google App Engine
This is Rietveld