4 <script src="../../js/resources/js-test-pre.js"></script>
7 <p id="description"></p>
8 <div id="console"></div>
10 description('This test aims to check for rangeOverflow flag with week input fields');
12 var input = document.createElement('input');
14 function checkOverflow(value, max, disabled)
18 input.disabled = !!disabled;
19 var overflow = input.validity.rangeOverflow;
20 var resultText = 'The value "' + input.value + '" ' +
21 (overflow ? 'overflows' : 'doesn\'t overflow') +
22 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
24 testPassed(resultText);
26 testFailed(resultText);
29 function checkNotOverflow(value, max, disabled)
33 input.disabled = !!disabled;
34 var overflow = input.validity.rangeOverflow;
35 var resultText = 'The value "' + input.value + '" ' +
36 (overflow ? 'overflows' : 'doesn\'t overflow') +
37 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
39 testFailed(resultText);
41 testPassed(resultText);
47 checkNotOverflow('2010-W01', null);
48 checkNotOverflow('2010-W01', '');
49 checkNotOverflow('2010-W01', 'foo');
50 checkNotOverflow('2010-W01', '2010-W01');
51 checkNotOverflow('2010-W01', '2010-W02');
52 checkNotOverflow('2010-W01', '2011-W01');
53 checkNotOverflow('foo', '2011-W01');
54 checkNotOverflow('2010-W01', '0000-W01'); // Invalid max value.
57 checkOverflow('2010-W01', '1582-W01');
58 checkOverflow('2010-W01', '2009-W12');
59 checkOverflow('9999-W01', '2010-W12');
60 input.min = '2010-W02'; // value < min && value > max
61 checkOverflow('2010-W01', '2009-W50');
64 checkNotOverflow('9999-W01', '2010-W12', true);
66 <script src="../../js/resources/js-test-post.js"></script>