| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/ui-helper.js"></script> |
| <script> |
| if (window.testRunner) |
| testRunner.waitUntilDone(); |
| </script> |
| </head> |
| <body> |
| <p>This tests that the caps lock indicator is not visible when the Strong Password AutoFill button is shown. It can only be tested in the test tool.</p> |
| <input type="password" value="A quick brown fox jumped over the lazy dog."> |
| <script> |
| function done() |
| { |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| |
| function handleCapsLockEnabled(event) |
| { |
| console.assert(event.key === "CapsLock"); |
| // FIXME: For some reason it takes up to 100ms for the caps lock indicator to be painted (why?). |
| window.setTimeout(done, 100); |
| } |
| |
| async function runTest() |
| { |
| if (!window.internals) |
| return; |
| |
| let input = document.querySelector("input"); |
| internals.setAutofilled(input, true); |
| internals.setShowAutoFillButton(input, "StrongPassword"); |
| |
| function handleFocus(event) { |
| console.assert(event.target === input); |
| input.addEventListener("keydown", handleCapsLockEnabled, { once: true }); |
| UIHelper.toggleCapsLock(); |
| } |
| input.addEventListener("focus", handleFocus, { once: true }); |
| UIHelper.activateElement(input); |
| } |
| |
| runTest(); |
| </script> |
| </body> |
| </html> |