4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../resources/common.js"></script>
9 description('Check stepping-up and -down for datetime-local input fields from renderer.');
11 var input
= document
.createElement('input');
13 document
.body
.appendChild(input
);
15 function keyDown(key
, modifiers
)
17 if (!window
.eventSender
)
19 eventSender
.keyDown(key
, modifiers
);
22 function setInputAttributes(value
, min
, max
, step
) {
29 function test(value
, step
, min
, max
, keySequence
) {
30 setInputAttributes(value
, min
, max
, step
);
31 for (var i
= 0; i
< keySequence
.length
; i
++)
32 keyDown(keySequence
[i
]);
36 function stepUp(value
, step
, min
, max
) {
37 return test(value
, step
, min
, max
, ['upArrow']);
40 function stepDown(value
, step
, min
, max
) {
41 return test(value
, step
, min
, max
, ['downArrow']);
44 input
.type
= 'datetime-local';
46 debug('Function arguments are (value, step, min, max, [keySequence]).');
47 debug('The hour field respects min/max attributes when they have the same date.');
48 keyDown('rightArrow');
49 keyDown('rightArrow');
50 keyDown('rightArrow');
51 shouldBeEqualToString('stepUp("2013-01-16T17:00", 1, "2013-01-16T15:00", "2013-01-16T17:00")', '2013-01-16T15:00');
52 shouldBeEqualToString('stepDown("2013-01-16T15:00", 1, "2013-01-16T15:00", "2013-01-16T17:00")', '2013-01-16T17:00');
53 shouldBeEqualToString('stepUp("2013-01-16T17:00", 1, "2013-01-16T15:00", "2013-01-17T17:00")', '2013-01-16T18:00');
54 shouldBeEqualToString('stepDown("2013-01-16T17:00", 1, "2013-01-16T17:00", "2013-01-17T20:00")', '2013-01-16T16:00');
57 document
.body
.removeChild(input
);