summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/rules/test/browser_rules_url-click-opens-new-tab.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--devtools/client/inspector/rules/test/browser_rules_url-click-opens-new-tab.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/devtools/client/inspector/rules/test/browser_rules_url-click-opens-new-tab.js b/devtools/client/inspector/rules/test/browser_rules_url-click-opens-new-tab.js
new file mode 100644
index 0000000000..0fe12dc859
--- /dev/null
+++ b/devtools/client/inspector/rules/test/browser_rules_url-click-opens-new-tab.js
@@ -0,0 +1,35 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Bug 1326626 - Tests that clicking a background url opens a new tab
+// even when the devtools is opened in a separate window.
+
+const TEST_URL =
+ "data:text/html,<style>body{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGD4DwABBAEAfbLI3wAAAABJRU5ErkJggg==) no-repeat}";
+
+add_task(async function () {
+ const { inspector } = await openInspectorForURL(TEST_URL, "window");
+ const view = selectRuleView(inspector);
+
+ await selectNode("body", inspector);
+
+ const anchor = view.styleDocument.querySelector(
+ ".ruleview-propertyvaluecontainer a"
+ );
+ ok(anchor, "Link exists for style tag node");
+
+ const onTabOpened = waitForTab();
+ anchor.click();
+
+ info("Wait for the image to open in a new tab");
+ const tab = await onTabOpened;
+ ok(tab, "A new tab opened");
+
+ is(
+ tab.linkedBrowser.currentURI.spec,
+ anchor.href,
+ "The new tab has the expected URL"
+ );
+});