Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / time / time-validity-rangeunderflow.html
bloba3443381608a765df8d7c43cf4bc234cf014102b
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description('This test aims to check for rangeUnderflow flag with time input fields');
12 var input = document.createElement('input');
14 function checkUnderflow(value, min, disabled)
16 input.value = value;
17 input.min = min;
18 input.disabled = !!disabled;
19 var underflow = input.validity.rangeUnderflow;
20 var resultText = 'The value "' + input.value + '" ' +
21 (underflow ? 'undeflows' : 'doesn\'t underflow') +
22 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
23 if (underflow)
24 testPassed(resultText);
25 else
26 testFailed(resultText);
29 function checkNotUnderflow(value, min, disabled, sanitized)
31 input.value = value;
32 input.min = min;
33 input.disabled = !!disabled;
34 var underflow = input.validity.rangeUnderflow;
35 var resultText = 'The value "' + input.value + '" ' +
36 (sanitized ? 'sanitized from "' + value + '" ' : '') +
37 (underflow ? 'underflows' : 'doesn\'t underflow') +
38 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
39 if (underflow)
40 testFailed(resultText);
41 else
42 testPassed(resultText);
45 function checkSanitizedValueNotUnderflow(value, max, disabled)
47 // For date types, invalid values are sanitized to "".
48 checkNotUnderflow(value, max, disabled, true);
51 input.type = 'time';
52 input.max = '';
53 // No underflow cases
54 checkNotUnderflow('13:16', null);
55 checkNotUnderflow('13:16', '');
56 checkNotUnderflow('13:16', 'foo');
57 checkNotUnderflow('00:00:00.000', '');
58 checkNotUnderflow('23:59:59.999', '');
59 checkNotUnderflow('13:16', '11:00');
60 checkNotUnderflow('13:16', '13:16');
61 checkSanitizedValueNotUnderflow('foo', '11:00');
63 // Underflow cases
64 checkUnderflow('13:16', '13:17');
65 checkUnderflow('23:59', '23:59:30');
66 input.max = '11:00'; // value < min && value > max
67 checkUnderflow('13:16', '14:00');
69 // Disabled
70 checkNotUnderflow('23:59', '23:59:30', true);
71 </script>
72 </body>
73 </html>