Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/ValidityState-tooLong-input.html

Issue 2100243002: Remove non-standardize key code names from event_sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix inspector tests that were missed by sed Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <p id="description"></p> 7 <p id="description"></p>
8 <div id="console"></div> 8 <div id="console"></div>
9 <script> 9 <script>
10 description('Tests for tooLong flag with &lt;input> elements.'); 10 description('Tests for tooLong flag with &lt;input> elements.');
(...skipping 16 matching lines...) Expand all
27 shouldBeFalse('input.validity.tooLong'); 27 shouldBeFalse('input.validity.tooLong');
28 28
29 debug(''); 29 debug('');
30 debug('Dirty value and longer than maxLength'); 30 debug('Dirty value and longer than maxLength');
31 input = document.createElement('input'); 31 input = document.createElement('input');
32 document.body.appendChild(input); 32 document.body.appendChild(input);
33 input.setAttribute('value', 'abcde'); 33 input.setAttribute('value', 'abcde');
34 input.maxLength = 3; 34 input.maxLength = 3;
35 input.focus(); 35 input.focus();
36 input.setSelectionRange(5, 5); // Move the cursor at the end. 36 input.setSelectionRange(5, 5); // Move the cursor at the end.
37 eventSender.keyDown('backspace'); 37 eventSender.keyDown('Backspace');
38 shouldBe('input.value.length', '4'); 38 shouldBe('input.value.length', '4');
39 shouldBeTrue('input.validity.tooLong'); 39 shouldBeTrue('input.validity.tooLong');
40 // Make the value <=maxLength. 40 // Make the value <=maxLength.
41 eventSender.keyDown('backspace'); 41 eventSender.keyDown('Backspace');
42 shouldBeFalse('input.validity.tooLong'); 42 shouldBeFalse('input.validity.tooLong');
43 43
44 debug(''); 44 debug('');
45 debug('Sets a value via DOM property'); 45 debug('Sets a value via DOM property');
46 input.maxLength = 3; 46 input.maxLength = 3;
47 input.value = 'abcde'; 47 input.value = 'abcde';
48 shouldBeFalse('input.validity.tooLong'); 48 shouldBeFalse('input.validity.tooLong');
49 49
50 debug(''); 50 debug('');
51 debug('Disabling makes the control valid'); 51 debug('Disabling makes the control valid');
52 input.focus(); 52 input.focus();
53 input.setSelectionRange(5, 5); // Move the cursor at the end. 53 input.setSelectionRange(5, 5); // Move the cursor at the end.
54 eventSender.keyDown('backspace'); 54 eventSender.keyDown('Backspace');
55 shouldBeTrue('input.validity.tooLong'); 55 shouldBeTrue('input.validity.tooLong');
56 shouldBeFalse('input.disabled = true; input.validity.tooLong'); 56 shouldBeFalse('input.disabled = true; input.validity.tooLong');
57 shouldBeTrue('input.disabled = false; input.validity.tooLong'); 57 shouldBeTrue('input.disabled = false; input.validity.tooLong');
58 58
59 debug(''); 59 debug('');
60 debug('Grapheme length is not greater than maxLength though character length is greater'); 60 debug('Grapheme length is not greater than maxLength though character length is greater');
61 // fancyX should be treated as 1 grapheme. 61 // fancyX should be treated as 1 grapheme.
62 // U+0305 COMBINING OVERLINE 62 // U+0305 COMBINING OVERLINE
63 // U+0332 COMBINING LOW LINE 63 // U+0332 COMBINING LOW LINE
64 var fancyX = "x\u0305\u0332"; 64 var fancyX = "x\u0305\u0332";
65 input = document.createElement('input'); 65 input = document.createElement('input');
66 document.body.appendChild(input); 66 document.body.appendChild(input);
67 input.value = fancyX + 'A'; // 4 characters, 2 grapheme clusters. 67 input.value = fancyX + 'A'; // 4 characters, 2 grapheme clusters.
68 input.maxLength = 1; 68 input.maxLength = 1;
69 input.focus(); 69 input.focus();
70 shouldBeFalse('input.validity.tooLong'); 70 shouldBeFalse('input.validity.tooLong');
71 eventSender.keyDown('backspace'); // Make the value dirty, 1 grapheme remains. 71 eventSender.keyDown('Backspace'); // Make the value dirty, 1 grapheme remains.
72 // Too long because there are three characters. 72 // Too long because there are three characters.
73 shouldBe('input.value.length', '3'); 73 shouldBe('input.value.length', '3');
74 shouldBeTrue('input.validity.tooLong'); 74 shouldBeTrue('input.validity.tooLong');
75 75
76 debug(''); 76 debug('');
77 debug('Change the type with a too long value'); 77 debug('Change the type with a too long value');
78 input.maxLength = 3; 78 input.maxLength = 3;
79 input.value = 'abcde'; 79 input.value = 'abcde';
80 input.type = 'search'; 80 input.type = 'search';
81 input.focus(); 81 input.focus();
82 input.setSelectionRange(5, 5); 82 input.setSelectionRange(5, 5);
83 eventSender.keyDown('backspace'); 83 eventSender.keyDown('Backspace');
84 shouldBeTrue('input.validity.tooLong'); 84 shouldBeTrue('input.validity.tooLong');
85 shouldBeFalse('input.type = "number"; input.validity.tooLong'); 85 shouldBeFalse('input.type = "number"; input.validity.tooLong');
86 input.type = "text"; 86 input.type = "text";
87 87
88 debug(''); 88 debug('');
89 debug('minlength and maxlength together'); 89 debug('minlength and maxlength together');
90 input.maxLength = 3; 90 input.maxLength = 3;
91 input.minLength = 3; 91 input.minLength = 3;
92 input.value = 'abcde'; 92 input.value = 'abcde';
93 input.focus(); 93 input.focus();
94 input.setSelectionRange(5, 5); 94 input.setSelectionRange(5, 5);
95 eventSender.keyDown('backspace'); 95 eventSender.keyDown('Backspace');
96 shouldBeTrue('input.validity.tooLong'); 96 shouldBeTrue('input.validity.tooLong');
97 shouldBeFalse('input.validity.tooShort'); 97 shouldBeFalse('input.validity.tooShort');
98 eventSender.keyDown('backspace'); 98 eventSender.keyDown('Backspace');
99 shouldBeFalse('input.validity.tooLong'); 99 shouldBeFalse('input.validity.tooLong');
100 shouldBeFalse('input.validity.tooShort'); 100 shouldBeFalse('input.validity.tooShort');
101 eventSender.keyDown('backspace'); 101 eventSender.keyDown('Backspace');
102 shouldBeFalse('input.validity.tooLong'); 102 shouldBeFalse('input.validity.tooLong');
103 shouldBeTrue('input.validity.tooShort'); 103 shouldBeTrue('input.validity.tooShort');
104 104
105 debug(''); 105 debug('');
106 debug('minlength and maxlength clashing'); 106 debug('minlength and maxlength clashing');
107 input.setAttribute('maxlength', '2'); 107 input.setAttribute('maxlength', '2');
108 input.setAttribute('minlength', '4'); 108 input.setAttribute('minlength', '4');
109 input.value = 'abcde'; 109 input.value = 'abcde';
110 input.focus(); 110 input.focus();
111 input.setSelectionRange(5, 5); 111 input.setSelectionRange(5, 5);
112 eventSender.keyDown('backspace'); 112 eventSender.keyDown('Backspace');
113 shouldBeTrue('input.validity.tooLong'); 113 shouldBeTrue('input.validity.tooLong');
114 shouldBeFalse('input.validity.tooShort'); 114 shouldBeFalse('input.validity.tooShort');
115 eventSender.keyDown('backspace'); 115 eventSender.keyDown('Backspace');
116 shouldBeTrue('input.validity.tooLong'); 116 shouldBeTrue('input.validity.tooLong');
117 shouldBeTrue('input.validity.tooShort'); 117 shouldBeTrue('input.validity.tooShort');
118 eventSender.keyDown('backspace'); 118 eventSender.keyDown('Backspace');
119 shouldBeFalse('input.validity.tooLong'); 119 shouldBeFalse('input.validity.tooLong');
120 shouldBeTrue('input.validity.tooShort'); 120 shouldBeTrue('input.validity.tooShort');
121 eventSender.keyDown('backspace'); 121 eventSender.keyDown('Backspace');
122 eventSender.keyDown('backspace'); 122 eventSender.keyDown('Backspace');
123 shouldBeFalse('input.validity.tooLong'); 123 shouldBeFalse('input.validity.tooLong');
124 shouldBeFalse('input.validity.tooShort'); 124 shouldBeFalse('input.validity.tooShort');
125 125
126 </script> 126 </script>
127 </body> 127 </body>
128 </html> 128 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698