Automatic update from web-platform-tests css-text-5: Update specification URL in text-fit tests Change-Id: Ie3c1ffa11d0ac25e04a7fe5790ca6f393efb54d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7904980 Reviewed-by: Koji Ishii <kojii@chromium.org> Commit-Queue: Koji Ishii <kojii@chromium.org> Auto-Submit: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/main@{#1643098} -- wpt-commits: eca981421a06cb6898eb31878579df4c4c16547a wpt-pr: 60463
61 lines
2.0 KiB
HTML
61 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<link rel="help" href="https://drafts.csswg.org/css-text-5/#text-fit-property">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<style>
|
|
body { margin: 0; }
|
|
.target {
|
|
white-space: pre;
|
|
background: lime;
|
|
margin-bottom: 10px;
|
|
width: 400px;
|
|
text-autospace: normal;
|
|
letter-spacing: 1px;
|
|
}
|
|
.scale {
|
|
text-fit: grow;
|
|
}
|
|
.scale-line {
|
|
text-fit: grow per-line-all;
|
|
}
|
|
.nospacing {
|
|
letter-spacing: 0;
|
|
}
|
|
.noautospace {
|
|
text-autospace: no-autospace;
|
|
}
|
|
</style>
|
|
<body lang="ja">
|
|
<!-- Specify letter-spacing:0 to the last letter to ensure it has no spacing. -->
|
|
<div class="target scale">高輪Gatewa<span class="nospacing">y</span></div>
|
|
<div class="target scale-line">高輪Gatewa<span class="nospacing">y</span></div>
|
|
|
|
<div class="target scale noautospace">高輪Gatewa<span class="nospacing">y</span></div>
|
|
<div class="target scale-line noautospace">高輪Gatewa<span class="nospacing">y</span></div>
|
|
|
|
<script>
|
|
test(() => {
|
|
const span = document.querySelector('.scale .nospacing');
|
|
assert_approx_equals(span.getBoundingClientRect().right, 400 - 1, 1,
|
|
'The last letter aligns with the right edge');
|
|
|
|
const spanRef = document.querySelector('.scale.noautospace .nospacing');
|
|
assert_not_equals(span.getBoundingClientRect().height,
|
|
spanRef.getBoundingClientRect().height,
|
|
'The used font-size is different from "no-autospace" case.');
|
|
}, '"text-autospace" and "consistent" work fine');
|
|
|
|
test(() => {
|
|
const span = document.querySelector('.scale-line .nospacing');
|
|
assert_approx_equals(span.getBoundingClientRect().right, 400 - 1, 1,
|
|
'The last letter aligns with the right edge');
|
|
|
|
const spanRef = document.querySelector('.scale-line.noautospace .nospacing');
|
|
assert_not_equals(span.getBoundingClientRect().height,
|
|
spanRef.getBoundingClientRect().height,
|
|
'The used font-size is different from "no-autospace" case.');
|
|
}, '"text-autospace" and "per-line-all" work fine');
|
|
</script>
|
|
</body>
|