2 <script src=
"../../../resources/js-test.js"></script>
5 internals
.settings
.setLangAttributeAwareFormControlUIEnabled(true);
7 debug('Require testRunner.');
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">
15 function displayValueForKeyInput(inputElement
, keyInputs
) {
16 inputElement
.value
= '';
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');
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');
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');