Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
|
keishi
2014/10/08 09:17:49
Changes to LayoutTests/fast/forms/ValidityState-to
Bartek Nowierski
2014/10/09 05:32:56
They kind of are, kind of aren't. My goal was to h
keishi
2014/10/09 05:59:55
Okay, but could you add a blurb in the CL descript
Bartek Nowierski
2014/10/09 06:26:59
Done.
| |
| 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 <input> elements.'); | 10 description('Tests for tooLong flag with <input> elements.'); |
| 11 | 11 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 41 document.execCommand('delete'); | 41 document.execCommand('delete'); |
| 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('Disabled'); | 51 debug('Disabling makes the control valid'); |
| 52 input.disabled = true; | 52 input.focus(); |
| 53 shouldBeFalse('input.validity.tooLong'); | 53 input.setSelectionRange(5, 5); // Move the cursor at the end. |
| 54 input.disabled = false; | 54 document.execCommand('delete'); |
| 55 shouldBeTrue('input.validity.tooLong'); | |
| 56 shouldBeFalse('input.disabled = true; input.validity.tooLong'); | |
| 57 shouldBeTrue('input.disabled = false; input.validity.tooLong'); | |
| 55 | 58 |
| 59 // TODO: The grapheme test below doesn't do its job because initial value is | |
|
keishi
2014/10/08 09:17:49
nit: style guideline says to use FIXME instead of
Bartek Nowierski
2014/10/09 05:32:56
Done.
| |
| 60 // always valid. After making a modificaton to trigger validity check, one can | |
| 61 // see that the test would fail, which possibly reveals a code issue. | |
|
keishi
2014/10/08 09:17:49
nit: This looks like a bug so maybe you can file a
Bartek Nowierski
2014/10/09 05:32:56
Done. https://code.google.com/p/chromium/issues/de
| |
| 62 // Once this is figured out, implement a similar test in | |
| 63 // ValidityState-tooShort-input.html | |
| 56 debug(''); | 64 debug(''); |
| 57 debug('Grapheme length is not greater than maxLength though character length is greater'); | 65 debug('Grapheme length is not greater than maxLength though character length is greater'); |
| 58 // fancyX should be treated as 1 grapheme. | 66 // fancyX should be treated as 1 grapheme. |
| 59 // U+0305 COMBINING OVERLINE | 67 // U+0305 COMBINING OVERLINE |
| 60 // U+0332 COMBINING LOW LINE | 68 // U+0332 COMBINING LOW LINE |
| 61 var fancyX = "x\u0305\u0332"; | 69 var fancyX = "x\u0305\u0332"; |
| 62 input = document.createElement('input'); | 70 input = document.createElement('input'); |
| 63 document.body.appendChild(input); | 71 document.body.appendChild(input); |
| 64 input.value = fancyX; // 3 characters, 1 grapheme clusters. | 72 input.value = fancyX; // 3 characters, 1 grapheme clusters. |
| 65 input.maxLength = 1; | 73 input.maxLength = 1; |
| 66 shouldBeFalse('input.validity.tooLong'); | 74 shouldBeFalse('input.validity.tooLong'); |
| 67 | 75 |
| 68 debug(''); | 76 debug(''); |
| 69 debug('Change the type with a too long value'); | 77 debug('Change the type with a too long value'); |
| 70 input.maxLength = 3; | 78 input.maxLength = 3; |
| 71 input.value = 'abcde'; | 79 input.value = 'abcde'; |
| 72 input.type = 'search'; | 80 input.type = 'search'; |
| 73 input.focus(); | 81 input.focus(); |
| 74 input.setSelectionRange(5, 5); | 82 input.setSelectionRange(5, 5); |
| 75 document.execCommand('delete'); | 83 document.execCommand('delete'); |
| 76 shouldBeTrue('input.validity.tooLong'); | 84 shouldBeTrue('input.validity.tooLong'); |
| 77 shouldBeFalse('input.type = "number"; input.validity.tooLong'); | 85 shouldBeFalse('input.type = "number"; input.validity.tooLong'); |
| 78 </script> | 86 </script> |
| 79 </body> | 87 </body> |
| 80 </html> | 88 </html> |
| OLD | NEW |