REGRESSION(r164329): Input fields are not honoring the maxlength attribute
[WebKit-https.git] / LayoutTests / fast / forms / input-maxlength-paste-clusters-in-middle.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/js-test-pre.js"></script>
5 <input type="text" maxlength="3" value="abc">
6 <script>
7
8 description('This test attempts to paste text in the middle of a text field with maxlength.');
9
10 var input = document.querySelector('input');
11 input.focus();
12 input.selectionStart = 1;
13 input.selectionEnd = 2;
14 shouldBeEqualToString('input.value', 'abc');
15 shouldBeEqualToString('input.getAttribute("maxlength")', '3');
16 evalAndLog('input.selectionStart = input.selectionEnd = 2');
17 evalAndLog('getSelection().modify("extend", "backward", "character")');
18 shouldBeEqualToString('document.execCommand("insertText", false, "\u0938\u094D"); input.value', 'a\u0938\u094Dc');
19 shouldBe('input.value.length', '4');
20
21 var successfullyParsed = true;
22
23 </script>
24 <script src="../../resources/js-test-post.js"></script>
25 </body>
26 </html>