| <!DOCTYPE html> |
| <html> |
| <head> |
| <script> |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| </script> |
| <script src='../../../fast/forms/resources/picker-common.js'></script> |
| </head> |
| <body> |
| <input type='color' id='color' value='#7EFFC9'> |
| |
| <p id='description' style='opacity: 0'></p> |
| <div id='console' style='opacity: 0'></div> |
| |
| <script> |
| let descriptionContainer = document.getElementById('description'); |
| openPicker(document.getElementById('color'), openPickerCallback, openPickerCallback); |
| |
| function openPickerCallback() { |
| if (internals.pagePopupWindow) { |
| descriptionContainer.append('Popup opened.', document.createElement('br')); |
| popupWindow.focus(); |
| const popupDocument = popupWindow.document; |
| const formatToggler = popupDocument.querySelector('format-toggler'); |
| const formatLabels = formatToggler.colorFormatLabels_; |
| formatToggler.focus(); |
| toggleFormatsAndLogFormatLabels(formatLabels, 'ArrowDown'); |
| toggleFormatsAndLogFormatLabels(formatLabels, 'ArrowUp'); |
| toggleFormatsAndLogFormatLabels(formatLabels, ' '); |
| } else { |
| descriptionContainer.append('Popup did not open.', document.createElement('br')); |
| } |
| descriptionContainer.append('TEST COMPLETE'); |
| 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]; |
| descriptionContainer.append(currentFormatLabel.textContent, document.createElement('br')); |
| } |
| } |
| </script> |
| </body> |
| </html> |