mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-06-14 20:50:24 +00:00
72 lines
2.6 KiB
HTML
72 lines
2.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for Bug </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">
|
|
<script type="application/javascript;version=1.8" src="inspector-helpers.js"></script>
|
|
<script type="application/javascript;version=1.8">
|
|
const {CssLogic} = require("devtools/server/css-logic");
|
|
|
|
window.onload = function() {
|
|
SimpleTest.waitForExplicitFinish();
|
|
runNextTest();
|
|
}
|
|
|
|
addTest(function getComputedStyle() {
|
|
let node = document.querySelector("#computed-style");
|
|
is (CssLogic.getComputedStyle(node).getPropertyValue("width"),
|
|
"50px", "Computed style on a normal node works (width)");
|
|
is (CssLogic.getComputedStyle(node).getPropertyValue("height"),
|
|
"10px", "Computed style on a normal node works (height)");
|
|
|
|
let firstChild = new _documentWalker(node, window).firstChild();
|
|
is (CssLogic.getComputedStyle(firstChild).getPropertyValue("content"),
|
|
"\"before\"", "Computed style on a ::before node works (content)");
|
|
let lastChild = new _documentWalker(node, window).lastChild();
|
|
is (CssLogic.getComputedStyle(lastChild).getPropertyValue("content"),
|
|
"\"after\"", "Computed style on a ::after node works (content)");
|
|
|
|
runNextTest();
|
|
});
|
|
|
|
addTest(function getBindingElementAndPseudo() {
|
|
let node = document.querySelector("#computed-style");
|
|
var {bindingElement, pseudo} = CssLogic.getBindingElementAndPseudo(node);
|
|
|
|
is (bindingElement, node,
|
|
"Binding element is the node itself for a normal node");
|
|
ok (!pseudo, "Pseudo is null for a normal node");
|
|
|
|
let firstChild = new _documentWalker(node, window).firstChild();
|
|
var {bindingElement, pseudo} = CssLogic.getBindingElementAndPseudo(firstChild);
|
|
is (bindingElement, node,
|
|
"Binding element is the parent for a pseudo node");
|
|
is (pseudo, ":before", "Pseudo is correct for a ::before node");
|
|
|
|
let lastChild = new _documentWalker(node, window).lastChild();
|
|
var {bindingElement, pseudo} = CssLogic.getBindingElementAndPseudo(lastChild);
|
|
is (bindingElement, node,
|
|
"Binding element is the parent for a pseudo node");
|
|
is (pseudo, ":after", "Pseudo is correct for a ::after node");
|
|
|
|
runNextTest();
|
|
});
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<style type="text/css">
|
|
#computed-style { width: 50px; height: 10px; }
|
|
#computed-style::before { content: "before"; }
|
|
#computed-style::after { content: "after"; }
|
|
</style>
|
|
<div id="computed-style"></div>
|
|
</body>
|
|
</html>
|