<!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" value="2021-07">
<script>
promise_test(() => {
let element = document.querySelector('input[type="month"]');
return openPicker(element)
.then(() => {
// Make the picker dismiss synchronously so we don't need to insert
// an artificial delay in the test
internals.pagePopupWindow.CalendarPicker.commitDelayMs = 0;
clickClearMonthButton();
assert_equals(element.value, "", "Clear button should have updated in-page control to empty string.");
assert_equals(internals.pagePopupWindow, null, "Click on Clear button should close popup.");
});
}, `Calendar picker: Clear button for input[type="month"] should clear date`);
</script>