Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / number / number-reject-invalid.html
blobbacab09854932c7d9cd4feec6163b72904327052
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>
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">
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();
23 debug('Arabic number input should accept ASCII digits and Arabic digits, and reject 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');
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.56');
35 shouldBeEqualToString('displayValueForKeyInput(frenchInput, "1234,56")', '1234.56');
37 debug('');
38 debug('English number input should accept ASCII digits and full stop, and no comma.');
39 var englishInput = document.getElementById('input-en');
40 shouldBeEqualToString('displayValueForKeyInput(englishInput, "1234.56")', '1234.56');
41 shouldBeEqualToString('displayValueForKeyInput(englishInput, "-1234,56")', '-123456');
42 shouldBeEqualToString('displayValueForKeyInput(englishInput, " abcdef ")', 'e');
43 </script>
44 </body>