mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Correct default Selectionstart and SelectionEnd
This commit is contained in:
parent
e19bab84cf
commit
b2c1f89b93
8 changed files with 144 additions and 87 deletions
|
@ -0,0 +1,35 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<textarea>g</textarea>
|
||||
<input type="text" value="foo">
|
||||
</input>
|
||||
<script>
|
||||
test(function() {
|
||||
let textarea = document.querySelector('textarea');
|
||||
assert_equals(textarea.selectionStart, 0);
|
||||
assert_equals(textarea.selectionEnd, 0);
|
||||
}, "Default selectionStart and selectionEnd for textarea");
|
||||
|
||||
test(function() {
|
||||
let textarea = document.querySelector('input');
|
||||
assert_equals(textarea.selectionStart, 0);
|
||||
assert_equals(textarea.selectionEnd, 0);
|
||||
}, "Default selectionStart and selectionEnd for input");
|
||||
|
||||
test(function() {
|
||||
let textarea = document.querySelector('textarea');
|
||||
textarea.value="g";
|
||||
assert_equals(textarea.selectionStart, 0);
|
||||
assert_equals(textarea.selectionEnd, 0);
|
||||
}, "selectionStart and selectionEnd do not change when same value set again");
|
||||
|
||||
test(function() {
|
||||
let textarea = document.querySelector('textarea');
|
||||
textarea.value="G";
|
||||
assert_equals(textarea.selectionStart, 1);
|
||||
assert_equals(textarea.selectionEnd, 1);
|
||||
}, "selectionStart and selectionEnd change when value changed to upper case");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue