<!doctype html>
<title>Test block-size of date-based inputs is consistent across writing-modes</title>
<link rel="help" href="https://html.spec.whatwg.org/#the-input-element">
<link rel="help" href="https://drafts.csswg.org/css-writing-modes-4/#block-flow">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<style>
input {
appearance: none;
font: 30px/1 Ahem;
}
</style>
<input id="horizontalInput">
<input id="verticalInput">
<script>
for (const inputType of ["date", "datetime-local", "month", "time", "week"]) {
horizontalInput.type = inputType;
verticalInput.type = inputType;
for (const writingMode of ["vertical-lr", "vertical-rl"]) {
test(t => {
verticalInput.style.writingMode = writingMode;
t.add_cleanup(() => {
verticalInput.removeAttribute("style");
});
const verticalRect = verticalInput.getBoundingClientRect();
const horizontalRect = horizontalInput.getBoundingClientRect();
assert_approx_equals(
verticalRect.width,
horizontalRect.height,
1,
"width of vertical input matches height of horizontal input",
);
}, `Test input[type=${inputType}] block-size in writing-mode: ${writingMode}`);
}
}
</script>