Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct default selectionStart and selectionEnd
- Loading branch information
1 parent
b517410
commit 87e7b1e
Showing
7 changed files
with
58 additions
and
26 deletions.
There are no files selected for viewing
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
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
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
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
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
4 changes: 0 additions & 4 deletions
4
tests/wpt/metadata/html/semantics/forms/textfieldselection/setSelectionRange.html.ini
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
tests/wpt/web-platform-tests/html/semantics/forms/textfieldselection/defaultSelection.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,28 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title></title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<textarea>foo</textarea> | ||
<input type="text" value="foo"></input> | ||
<script> | ||
|
||
for (let el of [document.querySelector("textarea"), document.querySelector("input")]) { | ||
test(function() { | ||
assert_equals(el.selectionStart, 0); | ||
assert_equals(el.selectionEnd, 0); | ||
}, `Default selectionStart and selectionEnd for ${el}`); | ||
|
||
test(function() { | ||
el.value="foo"; | ||
assert_equals(el.selectionStart, 0); | ||
assert_equals(el.selectionEnd, 0); | ||
}, `selectionStart and selectionEnd do not change when same value set again for ${el}`); | ||
|
||
test(function() { | ||
el.value="Foo"; | ||
assert_equals(el.selectionStart, 3); | ||
assert_equals(el.selectionEnd, 3); | ||
}, `selectionStart and selectionEnd change when value changed to upper case for ${el}`); | ||
} | ||
</script> |