Commit f0297bc5 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

CSS: Test computed Logical Height/Width limits

Web Platform Tests for the computed values of the
min-block-size/min-inline-size, and max-block-size/max-inline-size
properties.

https://drafts.csswg.org/css-logical/#dimension-properties

Change-Id: I8377da7f48575a64365af26ed6467411a63eac0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637004
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666610}
parent f8326725
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Logical Properties and Values: getComputedValue().maxBlockSize</title>
<link rel="help" href="https://drafts.csswg.org/css-logical/#propdef-max-block-size">
<meta name="assert" content="Computed max-block-size is the specified keyword, or the length-percentage made absolute.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
font-size: 40px;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("max-block-size", "none");
test_computed_value("max-block-size", "10px");
test_computed_value("max-block-size", "20%");
test_computed_value("max-block-size", "calc(10px + 0.5em)", "30px");
test_computed_value("max-block-size", "calc(10px - 0.5em)", "0px");
test_computed_value("max-block-size", "calc(20% + 10px)");
test_computed_value("max-block-size", "min-content");
test_computed_value("max-block-size", "max-content");
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Logical Properties and Values: getComputedValue().maxInlineSize</title>
<link rel="help" href="https://drafts.csswg.org/css-logical/#propdef-max-inline-size">
<meta name="assert" content="Computed max-inline-size is the specified keyword, or the length-percentage made absolute.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
font-size: 40px;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("max-inline-size", "none");
test_computed_value("max-inline-size", "10px");
test_computed_value("max-inline-size", "20%");
test_computed_value("max-inline-size", "calc(10px + 0.5em)", "30px");
test_computed_value("max-inline-size", "calc(10px - 0.5em)", "0px");
test_computed_value("max-inline-size", "calc(20% + 10px)");
test_computed_value("max-inline-size", "min-content");
test_computed_value("max-inline-size", "max-content");
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Logical Properties and Values: getComputedValue().minBlockSize</title>
<link rel="help" href="https://drafts.csswg.org/css-logical/#propdef-min-block-size">
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#min-size-auto">
<meta name="assert" content="Computed min-block-size is the specified keyword, or the length-percentage made absolute.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
font-size: 40px;
}
#container {
display: flex;
}
#box {
min-block-size: auto;
}
</style>
</head>
<body>
<div id="target"></div>
<div id="container">
<div id="box"></div>
</div>
<script>
test_computed_value("min-block-size", "auto", "0px");
test_computed_value("min-block-size", "10px");
test_computed_value("min-block-size", "20%");
test_computed_value("min-block-size", "calc(10px + 0.5em)", "30px");
test_computed_value("min-block-size", "calc(10px - 0.5em)", "0px");
test_computed_value("min-block-size", "calc(20% + 10px)");
test_computed_value("min-block-size", "min-content");
test_computed_value("min-block-size", "max-content");
test(() => {
const picture = document.getElementById('box');
assert_equals(getComputedStyle(picture).minBlockSize, 'auto');
}, 'min-block-size auto computes to auto with flex layout.');
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Logical Properties and Values: getComputedValue().minInlineSize</title>
<link rel="help" href="https://drafts.csswg.org/css-logical/#propdef-min-inline-size">
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#min-size-auto">
<meta name="assert" content="Computed min-inline-size is the specified keyword, or the length-percentage made absolute.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
font-size: 40px;
}
#container {
display: flex;
}
#box {
min-inline-size: auto;
}
</style>
</head>
<body>
<div id="target"></div>
<div id="container">
<div id="box"></div>
</div>
<script>
test_computed_value("min-inline-size", "auto", "0px");
test_computed_value("min-inline-size", "10px");
test_computed_value("min-inline-size", "20%");
test_computed_value("min-inline-size", "calc(10px + 0.5em)", "30px");
test_computed_value("min-inline-size", "calc(10px - 0.5em)", "0px");
test_computed_value("min-inline-size", "calc(20% + 10px)");
test_computed_value("min-inline-size", "min-content");
test_computed_value("min-inline-size", "max-content");
test(() => {
const picture = document.getElementById('box');
assert_equals(getComputedStyle(picture).minInlineSize, 'auto');
}, 'min-inline-size auto computes to auto with flex layout.');
</script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment