4 <link rel="stylesheet" href="../../js/resources/js-test-style.css">
5 <script src="../../js/resources/js-test-pre.js"></script>
8 <p id="description"></p>
9 <div id="console"></div>
11 description('This test aims to check for rangeOverflow flag with date input fields');
13 var input = document.createElement('input');
15 function checkOverflow(value, max, disabled)
19 input.disabled = !!disabled;
20 var overflow = input.validity.rangeOverflow;
21 var resultText = 'The value "' + input.value + '" ' +
22 (overflow ? 'overflows' : 'doesn\'t overflow') +
23 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
25 testPassed(resultText);
27 testFailed(resultText);
30 function checkNotOverflow(value, max, disabled)
34 input.disabled = !!disabled;
35 var overflow = input.validity.rangeOverflow;
36 var resultText = 'The value "' + input.value + '" ' +
37 (overflow ? 'overflows' : 'doesn\'t overflow') +
38 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
40 testFailed(resultText);
42 testPassed(resultText);
48 checkNotOverflow('2010-01-27', null);
49 checkNotOverflow('2010-01-27', '');
50 checkNotOverflow('2010-01-27', 'foo');
51 checkNotOverflow('2010-01-27', '2010-01-27');
52 checkNotOverflow('2010-01-27', '2010-01-28');
53 checkNotOverflow('2010-01-27', '2011-01-26');
54 checkNotOverflow('foo', '2011-01-26');
55 checkNotOverflow('2010-01-27', '0000-01-01'); // Too small max value.
58 checkOverflow('2010-01-27', '2010-01-26');
59 checkOverflow('9999-01-01', '2010-12-31');
60 input.min = '2010-01-28'; // value < min && value > max
61 checkOverflow('2010-01-27', '2010-01-26');
64 checkNotOverflow('9999-01-01', '2010-12-31', true);
66 var successfullyParsed = true;
68 <script src="../../js/resources/js-test-post.js"></script>