summaryrefslogtreecommitdiffstats
path: root/layout/style/test/test_bug652486.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 /layout/style/test/test_bug652486.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/style/test/test_bug652486.html')
-rw-r--r--layout/style/test/test_bug652486.html192
1 files changed, 192 insertions, 0 deletions
diff --git a/layout/style/test/test_bug652486.html b/layout/style/test/test_bug652486.html
new file mode 100644
index 0000000000..cdee3f33a7
--- /dev/null
+++ b/layout/style/test/test_bug652486.html
@@ -0,0 +1,192 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=652486
+https://bugzilla.mozilla.org/show_bug.cgi?id=1039488
+-->
+<head>
+ <title>Test for Bug 652486, Bug 1039488 and Bug 1574222</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=652486">Mozilla Bug 652486</a>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1039488">Mozilla Bug 1039488</a>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1574222">Mozilla Bug 1574222</a>
+
+<p id="display"></p>
+<div id="content" style="display: none">
+ <div id="t"></div>
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 652486, Bug 1039488 and Bug 1574222 **/
+
+function c() {
+ return document.defaultView.getComputedStyle($('t')).
+ getPropertyValue("text-decoration");
+}
+
+// The default value of the 'color' property, which in turn establishes the
+// default value of 'text-decoration-color' (via the 'currentColor' keyword).
+var defaultLineColor = "rgb(0, 0, 0)";
+
+var tests = [
+ // When only text-decoration was specified, text-decoration should look like
+ // a longhand property. However, as of Bug 1574222, the getComputedStyle()
+ // serialization for "text-decoration" will always include the color,
+ // because we can't tell whether the resolved color value came from the
+ // initial "currentColor" value (and could safely be omitted) vs. whether it
+ // came from a custom specified value (and cannot be omitted).
+ { decoration: "none",
+ line: null, color: null, style: null,
+ expectedValue: defaultLineColor },
+ { decoration: "underline",
+ line: null, color: null, style: null,
+ expectedValue: "underline " + defaultLineColor },
+ { decoration: "overline",
+ line: null, color: null, style: null,
+ expectedValue: "overline " + defaultLineColor },
+ { decoration: "line-through",
+ line: null, color: null, style: null,
+ expectedValue: "line-through " + defaultLineColor },
+ { decoration: "blink",
+ line: null, color: null, style: null,
+ expectedValue: "blink " + defaultLineColor },
+ { decoration: "underline overline",
+ line: null, color: null, style: null,
+ expectedValue: "underline overline " + defaultLineColor },
+ { decoration: "underline line-through",
+ line: null, color: null, style: null,
+ expectedValue: "underline line-through " + defaultLineColor },
+ { decoration: "blink underline",
+ line: null, color: null, style: null,
+ expectedValue: "underline blink " + defaultLineColor },
+ { decoration: "underline blink",
+ line: null, color: null, style: null,
+ expectedValue: "underline blink " + defaultLineColor },
+
+ // When only text-decoration-line or text-blink was specified,
+ // text-decoration should look like a longhand property.
+ // However, as of Bug 1574222, the getComputedStyle() serialization for
+ // "text-decoration" will always include the color, because we can't tell
+ // whether the resolved color value came from the initial "currentColor"
+ // value (and could safely be omitted) vs. whether it came from a custom
+ // specified value (and cannot be omitted).
+ { decoration: null,
+ line: "blink", color: null, style: null,
+ expectedValue: "blink " + defaultLineColor },
+ { decoration: null,
+ line: "underline", color: null, style: null,
+ expectedValue: "underline " + defaultLineColor },
+ { decoration: null,
+ line: "overline", color: null, style: null,
+ expectedValue: "overline " + defaultLineColor },
+ { decoration: null,
+ line: "line-through", color: null, style: null,
+ expectedValue: "line-through " + defaultLineColor },
+ { decoration: null,
+ line: "blink underline", color: null, style: null,
+ expectedValue: "underline blink " + defaultLineColor },
+
+ // When text-decoration-color isn't its initial value,
+ // text-decoration should be a shorthand property.
+ { decoration: "blink",
+ line: null, color: "rgb(0, 0, 0)", style: null,
+ expectedValue: "blink rgb(0, 0, 0)" },
+ { decoration: "underline",
+ line: null, color: "black", style: null,
+ expectedValue: "underline rgb(0, 0, 0)" },
+ { decoration: "overline",
+ line: null, color: "#ff0000", style: null,
+ expectedValue: "overline rgb(255, 0, 0)" },
+ { decoration: "line-through",
+ line: null, color: "initial", style: null,
+ expectedValue: "line-through " + defaultLineColor },
+ { decoration: "blink underline",
+ line: null, color: "currentColor", style: null,
+ expectedValue: "underline blink " + defaultLineColor },
+ { decoration: "underline line-through",
+ line: null, color: "currentcolor", style: null,
+ expectedValue: "underline line-through " + defaultLineColor },
+
+ // When text-decoration-style isn't its initial value,
+ // text-decoration should be a shorthand property.
+ { decoration: "blink",
+ line: null, color: null, style: "-moz-none",
+ expectedValue: "blink -moz-none " + defaultLineColor },
+ { decoration: "underline",
+ line: null, color: null, style: "dotted",
+ expectedValue: "underline dotted " + defaultLineColor },
+ { decoration: "overline",
+ line: null, color: null, style: "dashed",
+ expectedValue: "overline dashed " + defaultLineColor },
+ { decoration: "line-through",
+ line: null, color: null, style: "double",
+ expectedValue: "line-through double " + defaultLineColor },
+ { decoration: "blink underline",
+ line: null, color: null, style: "wavy",
+ expectedValue: "underline blink wavy " + defaultLineColor },
+ { decoration: "underline blink overline line-through",
+ line: null, color: null, style: "solid",
+ expectedValue: "underline overline line-through blink " + defaultLineColor },
+ { decoration: "line-through overline underline",
+ line: null, color: null, style: "initial",
+ expectedValue: "underline overline line-through " + defaultLineColor }
+];
+
+function makeDeclaration(aTest)
+{
+ var str = "";
+ if (aTest.decoration) {
+ str += "text-decoration: " + aTest.decoration + "; ";
+ }
+ if (aTest.color) {
+ str += "text-decoration-color: " + aTest.color + "; ";
+ }
+ if (aTest.line) {
+ str += "text-decoration-line: " + aTest.line + "; ";
+ }
+ if (aTest.style) {
+ str += "text-decoration-style: " + aTest.style + "; ";
+ }
+ return str;
+}
+
+function clearStyleObject()
+{
+ $('t').style.textDecoration = null;
+}
+
+for (var i = 0; i < tests.length; ++i) {
+ var test = tests[i];
+ if (test.decoration) {
+ $('t').style.textDecoration = test.decoration;
+ }
+ if (test.color) {
+ $('t').style.textDecorationColor = test.color;
+ }
+ if (test.line) {
+ $('t').style.textDecorationLine = test.line;
+ }
+ if (test.style) {
+ $('t').style.textDecorationStyle = test.style;
+ }
+
+ var dec = makeDeclaration(test);
+ is(c(), test.expectedValue, "Test1 (computed value): " + dec);
+
+ clearStyleObject();
+
+ $('t').setAttribute("style", dec);
+
+ is(c(), test.expectedValue, "Test2 (computed value): " + dec);
+
+ $('t').removeAttribute("style");
+}
+
+</script>
+</pre>
+</body>
+</html>