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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/ValidityState-tooShort-textarea.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 <script src="resources/common.js"></script> 5 <script src="resources/common.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <p id="description"></p> 8 <p id="description"></p>
9 <div id="console"></div> 9 <div id="console"></div>
10 <script> 10 <script>
(...skipping 17 matching lines...) Expand all
28 shouldBeFalse('textarea.validity.tooShort'); 28 shouldBeFalse('textarea.validity.tooShort');
29 29
30 debug(''); 30 debug('');
31 debug('Dirty value and longer than minLength'); 31 debug('Dirty value and longer than minLength');
32 textarea = document.createElement('textarea'); 32 textarea = document.createElement('textarea');
33 document.body.appendChild(textarea); 33 document.body.appendChild(textarea);
34 textarea.defaultValue = 'ab'; 34 textarea.defaultValue = 'ab';
35 textarea.minLength = 3; 35 textarea.minLength = 3;
36 textarea.focus(); 36 textarea.focus();
37 textarea.setSelectionRange(2, 2); // Move the cursor at the end. 37 textarea.setSelectionRange(2, 2); // Move the cursor at the end.
38 eventSender.keyDown('backspace'); 38 eventSender.keyDown('Backspace');
39 shouldBe('textarea.value.length', '1'); 39 shouldBe('textarea.value.length', '1');
40 shouldBeTrue('textarea.validity.tooShort'); 40 shouldBeTrue('textarea.validity.tooShort');
41 // Make the value empty, which means valid. 41 // Make the value empty, which means valid.
42 eventSender.keyDown('backspace'); 42 eventSender.keyDown('Backspace');
43 shouldBe('textarea.value.length', '0'); 43 shouldBe('textarea.value.length', '0');
44 shouldBeFalse('textarea.validity.tooShort'); 44 shouldBeFalse('textarea.validity.tooShort');
45 sendString('ab'); 45 sendString('ab');
46 shouldBe('textarea.value.length', '2'); 46 shouldBe('textarea.value.length', '2');
47 shouldBeTrue('textarea.validity.tooShort'); 47 shouldBeTrue('textarea.validity.tooShort');
48 // Make the value >=minLength. 48 // Make the value >=minLength.
49 sendString('c'); 49 sendString('c');
50 shouldBe('textarea.value.length', '3'); 50 shouldBe('textarea.value.length', '3');
51 shouldBeFalse('textarea.validity.tooShort'); 51 shouldBeFalse('textarea.validity.tooShort');
52 52
53 debug(''); 53 debug('');
54 debug('Sets a value via DOM property'); 54 debug('Sets a value via DOM property');
55 textarea = document.createElement('textarea'); 55 textarea = document.createElement('textarea');
56 document.body.appendChild(textarea); 56 document.body.appendChild(textarea);
57 textarea.minLength = 3; 57 textarea.minLength = 3;
58 textarea.defaultValue = 'ab'; 58 textarea.defaultValue = 'ab';
59 shouldBeFalse('textarea.validity.tooShort'); 59 shouldBeFalse('textarea.validity.tooShort');
60 60
61 debug(''); 61 debug('');
62 debug('Disabling makes the control valid'); 62 debug('Disabling makes the control valid');
63 textarea.focus(); 63 textarea.focus();
64 textarea.setSelectionRange(2, 2); // Move the cursor at the end. 64 textarea.setSelectionRange(2, 2); // Move the cursor at the end.
65 eventSender.keyDown('backspace'); 65 eventSender.keyDown('Backspace');
66 shouldBeTrue('textarea.validity.tooShort'); 66 shouldBeTrue('textarea.validity.tooShort');
67 shouldBeFalse('textarea.disabled = true; textarea.validity.tooShort'); 67 shouldBeFalse('textarea.disabled = true; textarea.validity.tooShort');
68 shouldBeTrue('textarea.disabled = false; textarea.validity.tooShort'); 68 shouldBeTrue('textarea.disabled = false; textarea.validity.tooShort');
69 69
70 debug(''); 70 debug('');
71 debug('A value set by resetting a form doesn\'t make tooShort true.'); 71 debug('A value set by resetting a form doesn\'t make tooShort true.');
72 // Make a dirty textarea. 72 // Make a dirty textarea.
73 var parent = document.createElement('div'); 73 var parent = document.createElement('div');
74 document.body.appendChild(parent); 74 document.body.appendChild(parent);
75 parent.innerHTML = '<form><textarea minlength=3>ab</textarea></form>'; 75 parent.innerHTML = '<form><textarea minlength=3>ab</textarea></form>';
76 textarea = parent.firstChild.firstChild; 76 textarea = parent.firstChild.firstChild;
77 textarea.focus(); 77 textarea.focus();
78 textarea.setSelectionRange(2, 2); 78 textarea.setSelectionRange(2, 2);
79 eventSender.keyDown('backspace'); 79 eventSender.keyDown('Backspace');
80 shouldBeTrue('textarea.validity.tooShort'); 80 shouldBeTrue('textarea.validity.tooShort');
81 parent.firstChild.reset(); 81 parent.firstChild.reset();
82 shouldBe('textarea.value', '"ab"'); 82 shouldBe('textarea.value', '"ab"');
83 shouldBeFalse('textarea.validity.tooShort'); 83 shouldBeFalse('textarea.validity.tooShort');
84 84
85 debug(''); 85 debug('');
86 debug('A value set by a child node change doesn\'t make tooShort true.'); 86 debug('A value set by a child node change doesn\'t make tooShort true.');
87 parent.innerHTML = '<textarea minlength=3>ab</textarea>'; 87 parent.innerHTML = '<textarea minlength=3>ab</textarea>';
88 textarea = parent.firstChild; 88 textarea = parent.firstChild;
89 shouldBeFalse('textarea.validity.tooShort'); 89 shouldBeFalse('textarea.validity.tooShort');
90 parent.firstChild.innerHTML = 'a'; 90 parent.firstChild.innerHTML = 'a';
91 shouldBe('textarea.value', '"a"'); 91 shouldBe('textarea.value', '"a"');
92 shouldBeFalse('textarea.validity.tooShort'); 92 shouldBeFalse('textarea.validity.tooShort');
93 93
94 debug(''); 94 debug('');
95 debug('Grapheme length is shorter than minLength though character length is grea ter'); 95 debug('Grapheme length is shorter than minLength though character length is grea ter');
96 // fancyX should be treated as 1 grapheme. 96 // fancyX should be treated as 1 grapheme.
97 // U+0305 COMBINING OVERLINE 97 // U+0305 COMBINING OVERLINE
98 // U+0332 COMBINING LOW LINE 98 // U+0332 COMBINING LOW LINE
99 var fancyX = 'x\u0305\u0332'; 99 var fancyX = 'x\u0305\u0332';
100 textarea = document.createElement('textarea'); 100 textarea = document.createElement('textarea');
101 document.body.appendChild(textarea); 101 document.body.appendChild(textarea);
102 textarea.value = fancyX + 'A'; // 4 characters, 2 grapheme cluster. 102 textarea.value = fancyX + 'A'; // 4 characters, 2 grapheme cluster.
103 textarea.minLength = 2; 103 textarea.minLength = 2;
104 textarea.focus(); 104 textarea.focus();
105 shouldBeFalse('textarea.validity.tooShort'); 105 shouldBeFalse('textarea.validity.tooShort');
106 eventSender.keyDown('backspace'); // Make the value dirty, 1 grapheme remains. 106 eventSender.keyDown('Backspace'); // Make the value dirty, 1 grapheme remains.
107 // Not too short because there are three characters. 107 // Not too short because there are three characters.
108 shouldBe('textarea.value.length', '3'); 108 shouldBe('textarea.value.length', '3');
109 shouldBeFalse('textarea.validity.tooShort'); 109 shouldBeFalse('textarea.validity.tooShort');
110 textarea.remove(); 110 textarea.remove();
111 </script> 111 </script>
112 </body> 112 </body>
113 </html> 113 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698