blob: 436e3a274c68aea0841d3af553a73306e4eebcbb [file] [log] [blame]
<!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\u0938\u094Dc');
shouldBe('input.value.length', '4');
var successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>