<!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="month1" value="2000-01">
<script>
promise_test(() => {
var month1 = document.getElementById('month1');
return openPicker(month1).then(() => {
var markDirtyCounter = 0;
let promise = new Promise((resolve, reject) => {
accessibilityController.setNotificationListener(function(axnode, type) {
if (type == 'MarkDirty' && ++ markDirtyCounter >= 2) {
assert_equals(month1.value, "2000-05", "Arrow key in month picker should have changed value");
resolve();
}
});
// In case of failure, reject the promise so we get some logs instead of timing out.
window.setTimeout(() => {
reject(`Didn't receive expected events. Got ${markDirtyCounter} MarkDirty`);
}, 1500);
});
eventSender.keyDown('ArrowDown');
// This forces an a11y flush.
accessibilityController.focusedElement;
return promise;
});
}, 'Tests if typing an arrow key dispatches |MarkDirty| a11y events.');
</script>