chromium/third_party/blink/web_tests/fast/forms/color/color-picker-keyboard-up-down-space-format-toggle.html

<!DOCTYPE html>
<meta name=fuzzy content="maxDifference=0-3; totalPixels=0-1000">
<script>
testRunner.dumpAsText();
testRunner.waitUntilDone();
</script>
<script src="../../../resources/testdriver.js"></script>
<script src="../../../resources/testdriver-vendor.js"></script>
<script src='../../../fast/forms/resources/picker-common.js'></script>

<input type='color' id='color' value='#7EFFC9'>

<p id='description' style='opacity: 0'></p>
<div id='console' style='opacity: 0'></div>

<script>
window.onload = () => {
  let descriptionContainer = document.getElementById('description');
  openPicker(document.getElementById('color'))
  .then(() => {
    descriptionContainer.append('Popup opened.', document.createElement('br'));
    internals.pagePopupWindow.focus();
    const popupDocument = internals.pagePopupWindow.document;
    const formatToggler = popupDocument.querySelector('format-toggler');
    const formatLabels = formatToggler.colorFormatLabels_;
    formatToggler.focus();
    toggleFormatsAndLogFormatLabels(formatLabels, 'ArrowDown');
    toggleFormatsAndLogFormatLabels(formatLabels, 'ArrowUp');
    toggleFormatsAndLogFormatLabels(formatLabels, ' ');
    descriptionContainer.append('TEST COMPLETE');
    testRunner.notifyDone();
  })
  .catch((e) => {
    descriptionContainer.append('Popup did not open.' + e, document.createElement('br'));
    testRunner.notifyDone();
  });
}

function toggleFormatsAndLogFormatLabels(formatLabels, keyDownString) {
  for(let i = 0; i < formatLabels.length; i++) {
    eventSender.keyDown(keyDownString);
    let currentFormatLabel = formatLabels.filter((formatLabel) => {
      return !formatLabel.classList.contains('hidden-format-label');
    })[0];
    document.getElementById('description').append(currentFormatLabel.textContent, document.createElement('br'));
  }
}
</script>