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

Unified Diff: test/browser/elemHideEmulation.js

Issue 29517687: Issue 5079, 5516 - Use webpack for browser tests, modules for content scripts (Closed)
Patch Set: Addressed Wladimir's and Hubert's initial feedback Created Aug. 17, 2017, 12:36 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/_bootstrap.js ('k') | test_runner.js » ('j') | test_runner.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/browser/elemHideEmulation.js
diff --git a/test/browser/elemHideEmulation.js b/test/browser/elemHideEmulation.js
index a7b6ce8f375f937f95f529584df729ca172d0088..f0d637839ea0128c3e27040723b29747c13b1c6b 100644
--- a/test/browser/elemHideEmulation.js
+++ b/test/browser/elemHideEmulation.js
@@ -17,9 +17,7 @@
"use strict";
-/* globals ElemHideEmulation */
-
-let myUrl = document.currentScript.src;
+const {ElemHideEmulation} = require("../../lib/content/elemHideEmulation");
exports.tearDown = function(callback)
{
@@ -74,7 +72,7 @@ function insertStyleRule(rule)
styleElement.sheet.insertRule(rule, styleElement.sheet.cssRules.length);
}
-// insert a <div> with a unique id and a CSS rule
+// Insert a <div> with a unique id and a CSS rule
// for the the selector matching the id.
function createElementWithStyle(styleBlock, parent)
{
@@ -88,31 +86,10 @@ function createElementWithStyle(styleBlock, parent)
return element;
}
-// Will ensure the class ElemHideEmulation is loaded.
-// Pass true when it calls itself.
-function loadElemHideEmulation(inside)
-{
- if (typeof ElemHideEmulation == "undefined")
- {
- if (inside)
- return Promise.reject("Failed to load ElemHideEmulation.");
-
- return loadScript(myUrl + "/../../../lib/common.js").then(() =>
- {
- return loadScript(myUrl + "/../../../chrome/content/elemHideEmulation.js");
- }).then(() =>
- {
- return loadElemHideEmulation(true);
- });
- }
-
- return Promise.resolve();
-}
-
// Create a new ElemHideEmulation instance with @selectors.
function applyElemHideEmulation(selectors)
{
- return loadElemHideEmulation().then(() =>
+ return Promise.resolve().then(() =>
{
let elemHideEmulation = new ElemHideEmulation(
window,
@@ -140,7 +117,7 @@ function applyElemHideEmulation(selectors)
);
elemHideEmulation.apply();
- return Promise.resolve(elemHideEmulation);
+ return elemHideEmulation;
});
}
« no previous file with comments | « test/browser/_bootstrap.js ('k') | test_runner.js » ('j') | test_runner.js » ('J')

Powered by Google App Engine
This is Rietveld