Index: LayoutTests/fast/forms/select/select-typeahead-with-spacekey.html |
diff --git a/LayoutTests/fast/forms/select/select-typeahead-with-spacekey.html b/LayoutTests/fast/forms/select/select-typeahead-with-spacekey.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3fabb548186259e4ebee20fc63b9d664ed88d17e |
--- /dev/null |
+++ b/LayoutTests/fast/forms/select/select-typeahead-with-spacekey.html |
@@ -0,0 +1,86 @@ |
+<!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(); |
+ setTimeout(test2, 1000); |
+} |
+ |
+function test2() { |
+ 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(' '); |
+ setTimeout(function() { |
+ keyDown('S'); |
+ shouldBeFalse('internals.isSelectPopupVisible(popup)'); |
+ shouldBeEqualToString('popup.value', 'Spain'); |
+ popup.blur(); |
+ setTimeout(test3, 1000); |
+ }, 1000); |
+} |
+ |
+function test3() { |
+ 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'); |
+ setTimeout(function() { |
+ keyDown(' '); |
+ shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
+ shouldBeEqualToString('popup.value', 'United Arab Emerites'); |
+ popup.blur(); |
+ finishJSTest(); |
+ }, 1000); |
+} |
+ |
+test1(); |
+</script> |
+</body> |