forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test how line-height works on <input type=text> and friends
See whatwg/html#5462
- Loading branch information
1 parent
fd7fa9c
commit 9e1780f
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
html/rendering/non-replaced-elements/form-controls/input-line-height-computed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<meta charset=utf-8> | ||
<title>used value and computed value of 'line-height' on input elements as text entry widgets</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-input-element-as-a-text-entry-widget"> | ||
<link rel="help" href="https://drafts.csswg.org/cssom/#resolved-values"> | ||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om/#computed-stylepropertymapreadonly-objects"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
input { line-height: 1px; } | ||
</style> | ||
<p><input type=text value=text> | ||
<p><input type=tel value=tel> | ||
<p><input type=search value=search> | ||
<p><input type=url value=url> | ||
<p><input type=email value=email> | ||
<p><input type=password value=password></p> | ||
<script> | ||
const inputs = document.querySelectorAll('input'); | ||
for (const input of inputs) { | ||
test(() => { | ||
const usedLineHeight = getComputedStyle(input).lineHeight; | ||
assert_not_equals(usedLineHeight, '1px', 'usedLineHeight'); | ||
assert_not_equals(usedLineHeight, 'normal', 'usedLineHeight'); | ||
}, `getComputedStyle(<input type=${input.type}>).lineHeight should return a used value that is no smaller than 'normal' (but should not literally be 'normal')`); | ||
test(() => { | ||
const computedLineHeight = input.computedStyleMap().get('line-height'); | ||
assert_equals(computedLineHeight.value, 1, 'computedLineHeight.value'); | ||
assert_equals(computedLineHeight.unit, 'px', 'computedLineHeight.unit'); | ||
}, `<input type=${input.type}>.computedStyleMap().get('line-height') should not be affected by the used value clamping`); | ||
} | ||
</script> |
12 changes: 12 additions & 0 deletions
12
html/rendering/non-replaced-elements/form-controls/input-line-height-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<title>Reference for 'line-height' smaller than 'normal' on input elements as text entry widgets</title> | ||
<style> | ||
input { font-size: 60px; width: 240px; } | ||
.appearance-none { appearance: none; } | ||
</style> | ||
<p><input type=text value=text> <input type=text value=text class=appearance-none> | ||
<p><input type=tel value=tel> <input type=tel value=tel class=appearance-none> | ||
<p><input type=search value=search> <input type=search value=search class=appearance-none> | ||
<p><input type=url value=url> <input type=url value=url class=appearance-none> | ||
<p><input type=email value=email> <input type=email value=email class=appearance-none> | ||
<p><input type=password value=password> <input type=password value=password class=appearance-none> |
13 changes: 13 additions & 0 deletions
13
html/rendering/non-replaced-elements/form-controls/input-line-height.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<title>'line-height' smaller than 'normal' on input elements as text entry widgets</title> | ||
<link rel="match" href="input-line-height-ref.html"> | ||
<style> | ||
input { font-size: 60px; line-height: 40px; width: 240px; } | ||
.appearance-none { appearance: none; } | ||
</style> | ||
<p><input type=text value=text> <input type=text value=text class=appearance-none> | ||
<p><input type=tel value=tel> <input type=tel value=tel class=appearance-none> | ||
<p><input type=search value=search> <input type=search value=search class=appearance-none> | ||
<p><input type=url value=url> <input type=url value=url class=appearance-none> | ||
<p><input type=email value=email> <input type=email value=email class=appearance-none> | ||
<p><input type=password value=password> <input type=password value=password class=appearance-none> |