Bug 1581008: Add test for :visited inactive CSS message. r=pbro
☠☠ backed out by b88f44533c97 ☠ ☠
authorDaisuke Akatsuka <daisuke@birchill.co.jp>
Tue, 24 Sep 2019 08:50:18 +0000
changeset 494880 1208c70dd3bd31c283c884a57000e2761fc09cb3
parent 494879 d69f8f5f9db4cadd95aa11f4c50570dbda413718
child 494881 4fc01a7061b648def4c21473ff4de73fc4926aa6
push id114131
push userdluca@mozilla.com
push dateThu, 26 Sep 2019 09:47:34 +0000
treeherdermozilla-inbound@1dc1a755079a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1581008
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1581008: Add test for :visited inactive CSS message. r=pbro Depends on D45626 Differential Revision: https://phabricator.services.mozilla.com/D46257
devtools/client/inspector/rules/test/browser.ini
devtools/client/inspector/rules/test/browser_rules_inactive_css_visited.js
--- a/devtools/client/inspector/rules/test/browser.ini
+++ b/devtools/client/inspector/rules/test/browser.ini
@@ -205,16 +205,17 @@ skip-if = os == 'linux' # focusEditableF
 [browser_rules_guessIndentation.js]
 [browser_rules_highlight-element-rule.js]
 [browser_rules_highlight-property.js]
 [browser_rules_highlight-used-fonts.js]
 [browser_rules_inactive_css_flexbox.js]
 [browser_rules_inactive_css_grid.js]
 [browser_rules_inactive_css_inline.js]
 [browser_rules_inactive_css_split-condition.js]
+[browser_rules_inactive_css_visited.js]
 [browser_rules_inherited-properties_01.js]
 [browser_rules_inherited-properties_02.js]
 [browser_rules_inherited-properties_03.js]
 [browser_rules_inherited-properties_04.js]
 [browser_rules_inline-source-map.js]
 [browser_rules_inline-style-order.js]
 [browser_rules_invalid.js]
 [browser_rules_invalid-source-map.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/rules/test/browser_rules_inactive_css_visited.js
@@ -0,0 +1,81 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test css properties that are inactive in :visited rule.
+
+const VISISTED_URI = URL_ROOT + "doc_variables_1.html";
+
+const TEST_URI = `
+  <style type='text/css'>
+    a:visited, #visited-and-other-matched-selector {
+      background-color: transparent;
+      border-color: lime;
+      color: rgba(0, 255, 0, 0.8);
+      font-size: 100px;
+      margin-left: 50px;
+    }
+  </style>
+  <a href="${VISISTED_URI}" id="visited-only">link1</a>
+  <a href="${VISISTED_URI}" id="visited-and-other-matched-selector">link2</a>
+`;
+
+const TEST_DATA = [
+  {
+    selector: "#visited-only",
+    inactiveDeclarations: [
+      {
+        declaration: { "font-size": "100px" },
+        ruleIndex: 1,
+      },
+      {
+        declaration: { "margin-left": "50px" },
+        ruleIndex: 1,
+      },
+    ],
+    activeDeclarations: [
+      {
+        declarations: {
+          "background-color": "transparent",
+          "border-color": "lime",
+          color: "rgba(0, 255, 0, 0.8)",
+        },
+        ruleIndex: 1,
+      },
+    ],
+  },
+  {
+    selector: "#visited-and-other-matched-selector",
+    activeDeclarations: [
+      {
+        declarations: {
+          "background-color": "transparent",
+          "border-color": "lime",
+          color: "rgba(0, 255, 0, 0.8)",
+          "font-size": "100px",
+          "margin-left": "50px",
+        },
+        ruleIndex: 1,
+      },
+    ],
+  },
+];
+
+add_task(async () => {
+  info("Open a particular url to make a visited link");
+  const tab = await addTab(VISISTED_URI);
+
+  info("Open tested page in the same tab");
+  tab.linkedBrowser.loadURI(
+    "data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI),
+    {
+      triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
+    }
+  );
+
+  info("Open the inspector");
+  const { inspector, view } = await openRuleView();
+
+  await runInactiveCSSTests(view, inspector, TEST_DATA);
+});