summaryrefslogtreecommitdiffstats
path: root/layout/inspector/tests/test_getRelativeRuleLine.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /layout/inspector/tests/test_getRelativeRuleLine.html
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/inspector/tests/test_getRelativeRuleLine.html')
-rw-r--r--layout/inspector/tests/test_getRelativeRuleLine.html68
1 files changed, 68 insertions, 0 deletions
diff --git a/layout/inspector/tests/test_getRelativeRuleLine.html b/layout/inspector/tests/test_getRelativeRuleLine.html
new file mode 100644
index 0000000000..0759aec56d
--- /dev/null
+++ b/layout/inspector/tests/test_getRelativeRuleLine.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test InspectorUtils::getRelativeRuleLine</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style>
+ @supports (not (whatever: 72 zq)) {
+ #test {
+ background-color: #f0c;
+ }
+ }
+
+ #test {
+ color: #f0c;
+ }
+ </style>
+ <style>#test { color: red; }</style>
+ <style>
+ @invalidatkeyword {
+ }
+
+ #test {
+ color: blue;
+ }
+ </style>
+ <script type="application/javascript">
+ const InspectorUtils = SpecialPowers.InspectorUtils;
+
+ let tests = [
+ { sheetNo: 0, ruleNo: 0, lineNo: 1, columnNo: 1 },
+ { sheetNo: 1, ruleNo: 0, lineNo: 2, columnNo: 5 },
+ { sheetNo: 1, ruleNo: 1, lineNo: 8, columnNo: 5 },
+ { sheetNo: 2, ruleNo: 0, lineNo: 1, columnNo: 1 },
+ { sheetNo: 2, ruleNo: 1, lineNo: 0, columnNo: 1 },
+ { sheetNo: 3, ruleNo: 0, lineNo: 5, columnNo: 6 },
+ ];
+
+ function doTest() {
+ document.styleSheets[2].insertRule("body{}", 1);
+ for (let test of tests) {
+ let sheet = document.styleSheets[test.sheetNo];
+ let rule = sheet.cssRules[test.ruleNo];
+ let line = InspectorUtils.getRelativeRuleLine(rule);
+ let column = InspectorUtils.getRuleColumn(rule);
+ info("testing sheet " + test.sheetNo + ", rule " + test.ruleNo);
+ is(line, test.lineNo, "line number is correct");
+ is(column, test.columnNo, "column number is correct");
+ }
+
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addLoadEvent(doTest);
+ </script>
+</head>
+<body>
+<h1>Test InspectorUtils::getRelativeRuleLine</h1>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>