| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| </head> |
| <body> |
| <select id="select"> |
| <option>Canada</option> |
| <option>Spain</option> |
| <option>United Arab Emerites</option> |
| <option>United States</option> |
| </select> |
| <script> |
| description('Two keystrokes are considered as part of one typehead session if time difference between them is less than 1 sec'); |
| |
| window.jsTestIsAsync = true; |
| |
| function keyDown(key, modifiers) |
| { |
| if (!window.eventSender) |
| return; |
| eventSender.keyDown(key, modifiers); |
| } |
| |
| var popup = document.getElementById("select"); |
| |
| function test1() { |
| debug('1. space key as part of search string.'); |
| popup.focus(); |
| popup.selectedIndex = 0; |
| keyDown('U'); |
| keyDown('n'); |
| keyDown('i'); |
| keyDown('t'); |
| keyDown('e'); |
| keyDown('d'); |
| keyDown(' '); |
| keyDown('S'); |
| shouldBeFalse('internals.isSelectPopupVisible(popup)'); |
| shouldBeEqualToString('popup.value', 'United States'); |
| popup.blur(); |
| |
| debug('2. space key as part of search string with some delay.'); |
| popup.focus(); |
| popup.selectedIndex = 0 |
| keyDown('U'); |
| keyDown('n'); |
| keyDown('i'); |
| keyDown('t'); |
| keyDown('e'); |
| keyDown('d'); |
| keyDown(' '); |
| internals.resetTypeAheadSession(popup); |
| keyDown('S'); |
| shouldBeFalse('internals.isSelectPopupVisible(popup)'); |
| shouldBeEqualToString('popup.value', 'Spain'); |
| popup.blur(); |
| |
| debug('3. space key to open popup menu.'); |
| popup.focus(); |
| popup.selectedIndex = 0 |
| keyDown('U'); |
| keyDown('n'); |
| keyDown('i'); |
| keyDown('t'); |
| keyDown('e'); |
| keyDown('d'); |
| internals.resetTypeAheadSession(popup); |
| keyDown(' '); |
| shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
| shouldBeEqualToString('popup.value', 'United Arab Emerites'); |
| popup.blur(); |
| finishJSTest(); |
| } |
| |
| test1(); |
| </script> |
| </body> |