blob: af60266f93a0763fa15750fee888f028ba79b626 [file]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<input type="text" maxlength="3" value="abc">
<script>
description('This test attempts to paste text in the middle of a text field with maxlength.');
var input = document.querySelector('input');
input.focus();
input.selectionStart = 1;
input.selectionEnd = 2;
shouldBeEqualToString('input.value', 'abc');
shouldBeEqualToString('input.getAttribute("maxlength")', '3');
evalAndLog('input.selectionStart = input.selectionEnd = 2');
evalAndLog('getSelection().modify("extend", "backward", "character")');
shouldBeEqualToString('document.execCommand("insertText", false, "\u0938\u094D"); input.value', 'a\u0938c');
shouldBe('input.value.length', '3');
var successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>