<!DOCTYPE html>
<meta name=fuzzy content="maxDifference=0-3; totalPixels=0-1000">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/testdriver.js"></script>
<script src="../../../resources/testdriver-vendor.js"></script>
<script src="../resources/common.js"></script>
<script src="../resources/picker-common.js"></script>
<script src="../calendar-picker/resources/calendar-picker-common.js"></script>
<input type="month" id="month-0" value="2018-06">
<script>
promise_test(() => {
let monthElement = document.getElementById('month-0');
return openPicker(monthElement)
.then(() => {
eventSender.keyDown('Home');
assert_equals(monthElement.value, "2018-01", "Home hotkey should go to the first of the year");
eventSender.keyDown('Home');
assert_equals(monthElement.value, "2017-01", "Home hotkey should go to the previous year");
eventSender.keyDown('End');
assert_equals(monthElement.value, "2017-12", "End hotkey should go to the end of the year");
eventSender.keyDown('End');
assert_equals(monthElement.value, "2018-12", "End hotkey should go to the next year");
eventSender.keyDown('Enter');
assert_equals(internals.pagePopupWindow, null, "Enter key should have closed popup.");
});
}, "Month picker: Home/end month hotkeys");
</script>