blob: 91065f17bcd2f532db1fa77478199cf61cbaf126 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.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>
</head>
<body>
<input type="datetime-local" id="datetime-local-0" value="2019-08-02T13:02" step="604800">
<script>
promise_test(() => {
let dateTimeElement = document.getElementById('datetime-local-0');
return openPickerWithPromise(dateTimeElement)
.then(() => {
// Make the picker dismiss synchronously so we don't need to insert
// an artificial delay in the test
internals.pagePopupWindow.CalendarPicker.commitDelayMs = 0;
clickNextMonthButton();
assert_equals(dateTimeElement.value, "2019-09-06T13:02", "Date in new month should be selected even though previous valid date is closer");
clickDayCellAt(5, 2);
eventSender.keyDown('Enter');
assert_equals(dateTimeElement.value, "2019-09-20T13:02", "Clicking date should have changed date");
assert_equals(internals.pagePopupWindow, null, "Popup should have closed");
});
}, "Datetimelocal picker: If closest target date is back in the current month, still jump to the value in the next month");
</script>
</body>
</html>