Truly independent web browser
LibWeb: Import computed margin value coverage
Andreas Klinga3619d68b012
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-box/parsing/margin-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-box/parsing/margin-computed.txtnew file mode 100644index 00000000000..8ab457ae646--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-box/parsing/margin-computed.txt@@ -0,0 +1,14 @@+Harness status: OK++Found 8 tests++3 Pass+5 Fail+Fail Property margin value '10px'+Fail Property margin value '10px 20px 30px 40px'+Fail Property margin value 'calc(0.5em + 10px)'+Fail Property margin value '30%'+Pass Property margin-top value '10px'+Fail Property margin-right value '20px'+Pass Property margin-bottom value '30px'+Pass Property margin-left value '40px'\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/getComputedStyle-margins-roundtrip.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/getComputedStyle-margins-roundtrip.txtnew file mode 100644index 00000000000..72ebf7c5add--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/getComputedStyle-margins-roundtrip.txt@@ -0,0 +1,9 @@+Harness status: OK++Found 4 tests++4 Fail+Fail Fixed-length margin-left property value should roundtrip+Fail Fixed-length margin-right property value should roundtrip+Fail Fixed-length margin-top property value should roundtrip+Fail Fixed-length margin-bottom property value should roundtrip\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-box/parsing/margin-computed.html b/Tests/LibWeb/Text/input/wpt-import/css/css-box/parsing/margin-computed.htmlnew file mode 100644index 00000000000..e8f875ef4f7--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/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>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/cssom/getComputedStyle-margins-roundtrip.html b/Tests/LibWeb/Text/input/wpt-import/css/cssom/getComputedStyle-margins-roundtrip.htmlnew file mode 100644index 00000000000..1822cf14c03--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/cssom/getComputedStyle-margins-roundtrip.html@@ -0,0 +1,35 @@+<!DOCTYPE html>+<title>Chromium bug: getComputedStyle() fixed-length inset values don't roundtrip</title>+<link rel="help" href="https://drafts.csswg.org/cssom/#resolved-value">+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1482703">+<link rel="help" href="mailto:[email protected]">+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>++<div id="target1" style="margin-left: 20.7px"></div>+<script>+test(() => {+ assert_equals(getComputedStyle(target1).marginLeft, '20.7px');+}, 'Fixed-length margin-left property value should roundtrip');+</script>++<div id="target2" style="margin-right: 20.7px"></div>+<script>+test(() => {+ assert_equals(getComputedStyle(target2).marginRight, '20.7px');+}, 'Fixed-length margin-right property value should roundtrip');+</script>++<div id="target3" style="margin-top: 20.7px"></div>+<script>+test(() => {+ assert_equals(getComputedStyle(target3).marginTop, '20.7px');+}, 'Fixed-length margin-top property value should roundtrip');+</script>++<div id="target4" style="margin-bottom: 20.7px"></div>+<script>+test(() => {+ assert_equals(getComputedStyle(target4).marginBottom, '20.7px');+}, 'Fixed-length margin-bottom property value should roundtrip');+</script>