<!DOCTYPE html>
<body>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../resources/common.js"></script>
<script>
input = document.createElement('input');
input.type = 'datetime-local';
input.step = '60';
document.body.appendChild(input);
function testTimeRollover(key1, key2, expected) {
test(() => {
input.value = "2020-08-21T00:00:00";
input.focus();
for (let i = 0; i < 3; i++)
eventSender.keyDown('ArrowRight');
eventSender.keyDown(key1);
eventSender.keyDown(key2);
assert_equals(input.value, '2020-08-21T' + expected);
input.blur();
}, `Putting ${key1} ${key2} to the hour field should set ${expected}`);
}
testTimeRollover('0', '1', '01:00');
testTimeRollover('1', '2', '00:00');
testTimeRollover('1', '3', '13:00');
testTimeRollover('1', '9', '19:00');
// 20+ is 2:--am
testTimeRollover('2', '3', '02:03');
</script>
</body>