зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1385926 - Add a test to ensure that the selection is always collapsed to the end after setting the value of input and textarea elements using the DOM API; r=masayuki
This commit is contained in:
Родитель
27fb550d1e
Коммит
8a7e6af123
|
@ -92,4 +92,27 @@ for (var data of elemData) {
|
|||
}, `value dirty flag behavior after setRangeText on ${data.desc}`);
|
||||
}
|
||||
|
||||
for (var tag of ['input', 'textarea']) {
|
||||
test(function() {
|
||||
var el = document.createElement(tag);
|
||||
document.body.appendChild(el);
|
||||
this.add_cleanup(() => el.remove());
|
||||
el.value = "";
|
||||
assert_equals(el.selectionStart, el.value.length,
|
||||
"element.selectionStart should be value.length");
|
||||
assert_equals(el.selectionEnd, el.value.length,
|
||||
"element.selectionEnd should be value.length");
|
||||
el.value = "foo";
|
||||
assert_equals(el.selectionStart, el.value.length,
|
||||
"element.selectionStart should be value.length");
|
||||
assert_equals(el.selectionEnd, el.value.length,
|
||||
"element.selectionEnd should be value.length");
|
||||
el.value = "foobar";
|
||||
assert_equals(el.selectionStart, el.value.length,
|
||||
"element.selectionStart should be value.length");
|
||||
assert_equals(el.selectionEnd, el.value.length,
|
||||
"element.selectionEnd should be value.length");
|
||||
}, `selection is always collapsed to the end after setting values on ${tag}`);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче