1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
10 description('Tests for .valueAsNumber with non-supported input types.');
12 var input
= document
.createElement('input');
14 document
.body
.appendChild(input
);
16 function checkValueAsNumber(type
) {
17 debug('Check for type=' + type
);
19 // Not allowed to set the value of file to anything except empty string.
20 input
.value
= (type
== 'file') ? '' : '0';
21 shouldBe('input.valueAsNumber', 'Number.NaN');
22 shouldThrow('input.valueAsNumber = 0', '"InvalidStateError: Failed to set the \'valueAsNumber\' property on \'HTMLInputElement\': This input element does not support Number values."');
25 checkValueAsNumber('button');
26 checkValueAsNumber('checkbox');
27 checkValueAsNumber('color');
28 checkValueAsNumber('email');
29 checkValueAsNumber('file');
30 checkValueAsNumber('hidden');
31 checkValueAsNumber('image');
32 checkValueAsNumber('khtml_isindex');
33 checkValueAsNumber('password');
34 checkValueAsNumber('radio');
35 checkValueAsNumber('reset');
36 checkValueAsNumber('search');
37 checkValueAsNumber('submit');
38 checkValueAsNumber('tel');
39 checkValueAsNumber('text');
40 checkValueAsNumber('url');