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

Unified Diff: test/browser/elemHideEmulation.js

Issue 30024560: Issue 7450 - Implement hide-if-contains-visible-text snippet (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: This is now a snippet Created April 5, 2019, 9:04 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/browser/_utils.js ('k') | test/browser/snippets.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/browser/elemHideEmulation.js
===================================================================
--- a/test/browser/elemHideEmulation.js
+++ b/test/browser/elemHideEmulation.js
@@ -14,17 +14,17 @@
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
const {ElemHideEmulation, setTestMode,
getTestInfo} = require("../../lib/content/elemHideEmulation");
-const {timeout} = require("./_utils");
+const {timeout, expectHidden, expectVisible} = require("./_utils");
const REFRESH_INTERVAL = 200;
let testDocument = null;
exports.setUp = function(callback)
{
setTestMode();
@@ -46,38 +46,16 @@
};
function unexpectedError(test, error)
{
console.error(error);
test.ok(false, "Unexpected error: " + error);
}
-function expectHidden(test, element, id)
-{
- let withId = "";
- if (typeof id != "undefined")
- withId = ` with ID '${id}'`;
-
- test.equal(
- window.getComputedStyle(element).display, "none",
- `The element${withId}'s display property should be set to 'none'`);
-}
-
-function expectVisible(test, element, id)
-{
- let withId = "";
- if (typeof id != "undefined")
- withId = ` with ID '${id}'`;
-
- test.notEqual(
- window.getComputedStyle(element).display, "none",
- `The element${withId}'s display property should not be set to 'none'`);
-}
-
function expectProcessed(test, element, id = null)
{
let withId = "";
if (id)
withId = ` with ID '${id}'`;
test.ok(
getTestInfo().lastProcessedElements.has(element),
« no previous file with comments | « test/browser/_utils.js ('k') | test/browser/snippets.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld