haikuwebkit/LayoutTests/fast/forms/input-maxlength-paste-clust...

27 lines
855 B
HTML

<!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>