Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / range / input-range-validation-message.html
blobde55fb1b8d934220b64db397a20076e3925dd0f0
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 description('Test for validationMessage IDL attribute for &lt;input type=range>');
9 var parent = document.createElement('div');
10 document.body.appendChild(parent);
11 parent.innerHTML = '<input type=range id=range maxlength=1 pattern=x>';
12 var input = document.getElementById('range');
14 function testIt(value, min, max, step)
16 input.setAttribute("max", max);
17 input.setAttribute("min", min);
18 input.setAttribute("step", step);
19 input.setAttribute("value", value);
20 return input.validationMessage;
23 debug('No message')
24 shouldBeEqualToString('testIt("", "", "")', '');
26 debug('Value missing')
27 input.setAttribute("required", "");
28 shouldBeEqualToString('testIt("", "", "")', '');
29 input.removeAttribute("required");
31 debug('Type mismatch');
32 shouldBeEqualToString('testIt("foo", "", "")', '');
34 debug('Range overflow')
35 shouldBeEqualToString('testIt("200", "", "100")', '');
37 debug('Range underflow')
38 shouldBeEqualToString('testIt("10", "50", "100")', '');
40 debug('Step mismatch')
41 shouldBeEqualToString('testIt("55", "0", "100", "10")', '');
43 </script>
44 </body>
45 </html>