chromium/third_party/blink/web_tests/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-reset-value-after-reload.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/picker-common.js"></script>
<script src="resources/suggestion-picker-common.js"></script>

<iframe></iframe>

<script>
window.onload = () => {
  const iframe = document.querySelector('iframe');
  const iframeLoaded = new Promise(resolve => iframe.addEventListener('load',resolve,{once:true}));
  iframe.srcdoc = '<input type=datetime-local id=test1 list=suggestions><input type=datetime-local id=test2 value=2002-02-02T00:00 list=suggestions><datalist id=suggestions><option>2012-01-01T00:00</option></datalist>';
  let element;
  promise_test(() => {
    return iframeLoaded
    .then(() => {
      element = iframe.contentDocument.getElementById('test1');
      return openPicker(element);
    })
    .then(() => {
      internals.pagePopupWindow.focus();

      assert_true(!highlightedEntry());
      eventSender.keyDown('ArrowDown');
      assert_equals(highlightedEntry(), '2012-01-01T00:00');
      eventSender.keyDown('Enter');
      return attemptToClosePicker(element);
    })
    .then(() => {
      assert_true(!internals.pagePopupWindow);
      assert_equals(element.value, '2012-01-01T00:00');
    })
    .then(() => {
      element = iframe.contentDocument.getElementById('test2');
      return openPicker(element);
    })
    .then(() => {
      internals.pagePopupWindow.focus();
      assert_true(!highlightedEntry());
      eventSender.keyDown('ArrowDown');
      assert_equals(highlightedEntry(), '2012-01-01T00:00');
      eventSender.keyDown('Enter');
      return attemptToClosePicker(element);
    })
    .then(() => {
      assert_true(!internals.pagePopupWindow);
      assert_equals(element.value, '2012-01-01T00:00');
      const iframeReloaded = new Promise(resolve => iframe.addEventListener('load',resolve,{once:true}));
      iframe.contentWindow.location.reload();
      return iframeReloaded;
    })
    .then(() => {
      assert_equals(iframe.contentDocument.getElementById('test1').value, '');
      assert_equals(iframe.contentDocument.getElementById('test2').value, '2002-02-02T00:00');
      iframe.remove();
    });
  },'Checks reloading page resets input values');
};
</script>