REGRESSION(r164329): Input fields are not honoring the maxlength attribute
[WebKit-https.git] / LayoutTests / fast / forms / input-maxlength-inserting-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 insert a character 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 = 1;
14 shouldBeEqualToString('input.value', 'abc');
15 shouldBeEqualToString('input.getAttribute("maxlength")', '3');
16
17 input.oninput = function () {
18     shouldBeEqualToString('input.value', 'abc');
19 }
20
21 if (window.eventSender)
22     eventSender.keyDown('1');
23 else
24     debug('To test manually, type in "1" into the text field. It should fail.');
25
26 var successfullyParsed = true;
27
28 </script>
29 <script src="../../resources/js-test-post.js"></script>
30 </body>
31 </html>