summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/mochitest/test_css-logic-media-queries.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/server/tests/mochitest/test_css-logic-media-queries.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/server/tests/mochitest/test_css-logic-media-queries.html')
-rw-r--r--devtools/server/tests/mochitest/test_css-logic-media-queries.html62
1 files changed, 62 insertions, 0 deletions
diff --git a/devtools/server/tests/mochitest/test_css-logic-media-queries.html b/devtools/server/tests/mochitest/test_css-logic-media-queries.html
new file mode 100644
index 000000000..bc465df55
--- /dev/null
+++ b/devtools/server/tests/mochitest/test_css-logic-media-queries.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Test that css-logic handles media-queries correctly
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test css-logic media-queries</title>
+ <script type="application/javascript" 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;version=1.8">
+
+ window.onload = function() {
+ var { classes: Cc, utils: Cu, interfaces: Ci } = Components;
+ const DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"]
+ .getService(Ci.inIDOMUtils);
+
+ var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+ var Services = require("Services");
+ const {CssLogic} = require("devtools/server/css-logic");
+
+ SimpleTest.waitForExplicitFinish();
+
+ let div = document.querySelector("div");
+ let cssLogic = new CssLogic(DOMUtils.isInheritedProperty);
+ cssLogic.highlight(div);
+ cssLogic.processMatchedSelectors();
+
+ let _strings = Services.strings
+ .createBundle("chrome://devtools-shared/locale/styleinspector.properties");
+
+ let inline = _strings.GetStringFromName("rule.sourceInline");
+
+ let source1 = inline + ":12";
+ let source2 = inline + ":19 @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>