chromium/third_party/blink/web_tests/fast/forms/week/week-picker-month-switcher-menu.html

<!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="week" id="week-0" value="2019-W07">
<input type="week" id="week-1" value="2019-W07">
<script>

promise_test(() => {
  let weekElement = document.getElementById('week-0');
  return openPicker(weekElement)
  .then(() => {
    // Make the picker dismiss synchronously so we don't need to insert
    // an artificial delay in the test
    internals.pagePopupWindow.CalendarPicker.commitDelayMs = 0;

    clickMonthPopupButton();
    eventSender.keyDown('ArrowRight');
    eventSender.keyDown('ArrowDown');
    eventSender.keyDown('Enter');
    assert_equals(weekElement.value, "2019-W28", "Month chooser button should have changed month");

    eventSender.keyDown('Enter');
    assert_equals(internals.pagePopupWindow, null, "Enter key should have dismissed popup.");
  });
}, "Week picker: Month chooser should allow user to chooser month");

promise_test(() => {
  let weekElement = document.getElementById('week-1');
  return openPicker(weekElement)
  .then(() => {
    // Make the picker dismiss synchronously so we don't need to insert
    // an artificial delay in the test
    internals.pagePopupWindow.CalendarPicker.commitDelayMs = 0;

    clickMonthPopupButton();
    eventSender.keyDown('ArrowRight');
    eventSender.keyDown('ArrowDown');
    eventSender.keyDown('Escape');
    clickDayCellAt(2, 2);

    assert_equals(weekElement.value, "2019-W07", "Escape key should have dismissed month chooser without changing month ");
  });
}, "Week picker: Month chooser should dismiss on Escape key");

</script>