<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description('Test for keyboard operations for &lt;input type=number>');
var parent = document.createElement('div');
document.body.appendChild(parent);
parent.innerHTML = '<input type=number id=number>';

var input = document.getElementById('number');
input.focus();
debug('Inserting "ab123cd":');
document.execCommand('InsertText', false, 'ab123cd');
shouldBe('input.value', '""');

debug('Press the up arrow key:');
input.valueAsNumber = 123;
eventSender.keyDown('upArrow');
shouldBe('input.value', '"124"');

debug('Press the down arrow key:');
eventSender.keyDown('downArrow');
shouldBe('input.value', '"123"');

debug('Disable input element:');
input.disabled = true;
eventSender.keyDown('upArrow');
shouldBe('input.value', '"123"');
input.removeAttribute('disabled');

debug('Read-only input element:');
input.readOnly = true;
eventSender.keyDown('upArrow');
shouldBe('input.value', '"123"');
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
