summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/chrome/test_css-logic-media-queries.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/server/tests/chrome/test_css-logic-media-queries.html
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/tests/chrome/test_css-logic-media-queries.html')
-rw-r--r--devtools/server/tests/chrome/test_css-logic-media-queries.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/devtools/server/tests/chrome/test_css-logic-media-queries.html b/devtools/server/tests/chrome/test_css-logic-media-queries.html
new file mode 100644
index 0000000000..feaf0f5d39
--- /dev/null
+++ b/devtools/server/tests/chrome/test_css-logic-media-queries.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Test that css-logic handles media-queries correctly
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test css-logic media-queries</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+ <style>
+ div {
+ width: 1000px;
+ height: 100px;
+ background-color: #f00;
+ }
+
+ @media screen and (min-width: 1px) {
+ div {
+ width: 200px;
+ }
+ }
+ </style>
+</head>
+<body>
+ <div></div>
+ <script type="application/javascript">
+ "use strict";
+
+ window.onload = function() {
+ const {require} = ChromeUtils.importESModule("resource://devtools/shared/loader/Loader.sys.mjs");
+ const {CssLogic} = require("devtools/server/actors/inspector/css-logic");
+
+ SimpleTest.waitForExplicitFinish();
+
+ const div = document.querySelector("div");
+ const cssLogic = new CssLogic();
+ cssLogic.highlight(div);
+ cssLogic.processMatchedSelectors();
+
+ const _strings = Services.strings
+ .createBundle("chrome://devtools-shared/locale/styleinspector.properties");
+
+ const inline = _strings.GetStringFromName("rule.sourceInline");
+
+ const source1 = inline + ":2";
+ const source2 = inline + ":9 @media screen and (min-width: 1px)";
+ is(cssLogic._matchedRules[0][0].source, source1,
+ "rule.source gives correct output for rule 1");
+ is(cssLogic._matchedRules[1][0].source, source2,
+ "rule.source gives correct output for rule 2");
+
+ SimpleTest.finish();
+ };
+ </script>
+</body>
+</html>