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 the behavior of .min and .max of HTMLInputElement.');
12 var input
= document
.createElement('input');
14 // .min and .max just reflect the corresponding attributes.
16 shouldBe('input.min', '""');
17 shouldBe('input.max', '""');
18 input
.setAttribute('min', '0');
19 input
.setAttribute('max', '100');
20 shouldBe('input.min', '"0"');
21 shouldBe('input.max', '"100"');
22 input
.setAttribute('min', 'abc');
23 input
.setAttribute('max', 'qwerty');
24 shouldBe('input.min', '"abc"');
25 shouldBe('input.max', '"qwerty"');
29 shouldBe('input.getAttribute("min")', '"foo"');
30 shouldBe('input.getAttribute("max")', '"bar"');
33 shouldBe('input.getAttribute("min")', '""');
34 shouldBe('input.getAttribute("max")', '""');
37 debug('Setting null to min:');
39 shouldBe('input.min', '"null"');
40 shouldBe('input.getAttribute("min")', '"null"');
41 input
.setAttribute('min', null);
42 shouldBe('input.min', '"null"');
44 debug('Setting null to max:');
46 shouldBe('input.max', '"null"');
47 shouldBe('input.getAttribute("max")', '"null"');
48 input
.setAttribute('max', null);
49 shouldBe('input.max', '"null"');
52 debug('Setting undefined to min:');
53 input
.min
= undefined;
54 shouldBe('input.min', '"undefined"');
55 shouldBe('input.getAttribute("min")', '"undefined"');
56 input
.setAttribute('min', undefined);
57 shouldBe('input.min', '"undefined"');
59 debug('Setting undefined to max:');
60 input
.max
= undefined;
61 shouldBe('input.max', '"undefined"');
62 shouldBe('input.getAttribute("max")', '"undefined"');
63 input
.setAttribute('max', undefined);
64 shouldBe('input.max', '"undefined"');
67 debug('Setting non-string to min:');
69 shouldBe('input.min', '"256"');
70 shouldBe('input.getAttribute("min")', '"256"');
71 input
.setAttribute('min', 256);
72 shouldBe('input.min', '"256"');
74 debug('Setting non-string to max:');
76 shouldBe('input.max', '"256"');
77 shouldBe('input.getAttribute("max")', '"256"');
78 input
.setAttribute('max', 256);
79 shouldBe('input.max', '"256"');
81 // The range type has the default minimum and the default maximum.
82 // But they aren't exposed by .min .max IDL attributes.
83 debug('Check implicit min/max of type=range:');
85 input
.setAttribute('min', '');
86 input
.setAttribute('max', '');
87 shouldBe('input.min', '""');
88 shouldBe('input.max', '""');