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

Side by Side Diff: LayoutTests/fast/forms/number/number-reject-invalid.html

Issue 1100273002: input[type=number] UI should reject invalid characters. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <script>
4 if (window.internals)
5 internals.settings.setLangAttributeAwareFormControlUIEnabled(true);
6 else
7 debug('Require testRunner.');
8 </script>
9
10 <input id="input-ar" lang="ar-eg" type="number">
11 <input id="input-fr" lang="fr-fr" type="number">
12 <input id="input-en" lang="en-us" type="number">
13
14 <script>
15 function displayValueForKeyInput(inputElement, keyInputs) {
16 inputElement.value = '';
17 inputElement.focus();
18 document.execCommand('InsertText', false, keyInputs);
19 inputElement.select();
20 return window.getSelection().toString();
21 }
22
23 debug('Arabic number input should accept ASCII digits and Arabic digits, and rej ect others.');
24 var arabicInput = document.getElementById('input-ar');
25 shouldBeEqualToString('displayValueForKeyInput(arabicInput, "123.4")', '123.4');
26 shouldBeEqualToString('displayValueForKeyInput(arabicInput, "1.23E+19")', '1.23E +19');
27 shouldBeEqualToString('displayValueForKeyInput(arabicInput, "1.23e-1")', '1.23e- 1');
28 shouldBeEqualToString('displayValueForKeyInput(arabicInput, "\u0661\u0669\u0660" )', '\u0661\u0669\u0660');
29 shouldBeEqualToString('displayValueForKeyInput(arabicInput, "acdef")', 'e');
30
31 debug('');
32 debug('French number input should accept ASCII digits, comma, and full stop.');
33 var frenchInput = document.getElementById('input-fr');
34 shouldBeEqualToString('displayValueForKeyInput(frenchInput, "1234.56")', '1234.5 6');
35 shouldBeEqualToString('displayValueForKeyInput(frenchInput, "1234,56")', '1234.5 6');
36
37 debug('');
38 debug('English number input should accept ASCII digits and full stop, and no com ma.');
39 var englishInput = document.getElementById('input-en');
40 shouldBeEqualToString('displayValueForKeyInput(englishInput, "1234.56")', '1234. 56');
41 shouldBeEqualToString('displayValueForKeyInput(englishInput, "-1234,56")', '-123 456');
42 shouldBeEqualToString('displayValueForKeyInput(englishInput, " abcdef ")', 'e');
43 </script>
44 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698