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