summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-box/parsing/margin-computed.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-box/parsing/margin-computed.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-box/parsing/margin-computed.html')
-rw-r--r--testing/web-platform/tests/css/css-box/parsing/margin-computed.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-box/parsing/margin-computed.html b/testing/web-platform/tests/css/css-box/parsing/margin-computed.html
new file mode 100644
index 0000000000..6c3b321c72
--- /dev/null
+++ b/testing/web-platform/tests/css/css-box/parsing/margin-computed.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS basic box model: getComputedStyle().margin</title>
+<link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-margin">
+<meta name="assert" content="margin computed value has absolute lengths.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/computed-testcommon.js"></script>
+<style>
+ #parent {
+ width: 200px;
+ }
+ #target {
+ width: 0px;
+ font-size: 40px;
+ }
+</style>
+</head>
+<body>
+<div id="parent">
+ <div id="target"></div>
+</div>
+<script>
+const target = document.getElementById("target");
+
+test_computed_value("margin", "10px");
+test_computed_value("margin", "10px 20px 30px 40px");
+test_computed_value("margin", "calc(0.5em + 10px)", "30px");
+test_computed_value("margin", "30%", "60px");
+
+// Since what should the margin be in presence of other margins is a bit
+// unclear (https://github.com/w3c/csswg-drafts/issues/2328), reset the margin
+// before testing.
+target.style.margin = "0";
+test_computed_value("margin-top", "10px");
+target.style.margin = "0";
+test_computed_value("margin-right", "20px");
+target.style.margin = "0";
+test_computed_value("margin-bottom", "30px");
+target.style.margin = "0";
+test_computed_value("margin-left", "40px");
+</script>
+</body>
+</html>