diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-02-24 10:22:51 +0100 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-02-24 10:24:32 +0100 |
commit | 50958718c22aab5a4f5061c313531259761648c5 (patch) | |
tree | e0e4903b788759e86752f5b28d0ba5f445cd32e0 /tests/unit/autocomplete | |
parent | ee34b0dabb066c4ec98a8eab824fa19bb9320eaf (diff) | |
download | jquery-ui-50958718c22aab5a4f5061c313531259761648c5.tar.gz jquery-ui-50958718c22aab5a4f5061c313531259761648c5.zip |
Autocomplete: Added support for contenteditable elements. Fixes #6914 - Autocomplete: Support contenteditable.
Diffstat (limited to 'tests/unit/autocomplete')
-rw-r--r-- | tests/unit/autocomplete/autocomplete.html | 1 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_events.js | 40 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/unit/autocomplete/autocomplete.html b/tests/unit/autocomplete/autocomplete.html index ef9d64baf..c4c3d8745 100644 --- a/tests/unit/autocomplete/autocomplete.html +++ b/tests/unit/autocomplete/autocomplete.html @@ -40,6 +40,7 @@ <div id="ac-wrap1" class="ac-wrap"></div> <div id="ac-wrap2" class="ac-wrap"><input id="autocomplete" class="foo" /></div> + <div id="autocomplete-contenteditable" contenteditable="" tabindex=0></div> </div> </body> diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js index 95a86425c..b0ee1acb4 100644 --- a/tests/unit/autocomplete/autocomplete_events.js +++ b/tests/unit/autocomplete/autocomplete_events.js @@ -51,6 +51,46 @@ test("all events", function() { }, 50); }); +test("all events - contenteditable", function() { + expect(12); + var ac = $("#autocomplete-contenteditable").autocomplete({ + delay: 0, + source: data, + search: function(event) { + same(event.type, "autocompletesearch"); + }, + open: function(event) { + same(event.type, "autocompleteopen"); + }, + focus: function(event, ui) { + same(event.type, "autocompletefocus"); + same(ui.item, {label:"java", value:"java"}); + }, + close: function(event) { + same(event.type, "autocompleteclose"); + same( $(".ui-menu:visible").length, 0 ); + }, + select: function(event, ui) { + same(event.type, "autocompleteselect"); + same(ui.item, {label:"java", value:"java"}); + }, + change: function(event, ui) { + same(event.type, "autocompletechange"); + same(ui.item, {label:"java", value:"java"}); + same( $(".ui-menu:visible").length, 0 ); + start(); + } + }); + stop(); + ac.focus().text("ja").keydown(); + setTimeout(function() { + same( $(".ui-menu:visible").length, 1 ); + ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); + ac.simulate("keydown", { keyCode: $.ui.keyCode.ENTER }); + $.browser.msie ? ac.simulate("blur") : ac.blur(); + }, 50); +}); + test("change without selection", function() { expect(2); stop(); |