aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorYermo <yml@yml.com>2014-01-25 17:39:27 -0500
committerScott González <scott.gonzalez@gmail.com>2014-01-28 12:35:16 -0500
commit605a20ef06b0bae2d2ffd8d96e49c2a297add80a (patch)
tree2490701d6dddde525c642c75611bc814b763ed89 /tests/unit
parentccb13240dd8b5cfac0199a30dcec4a71cbe1b252 (diff)
downloadjquery-ui-605a20ef06b0bae2d2ffd8d96e49c2a297add80a.tar.gz
jquery-ui-605a20ef06b0bae2d2ffd8d96e49c2a297add80a.zip
Autocomplete: Do not set value on multi-line input
This fixes an issue where contenteditable text was getting overwritten when wrapping past the bottom or top of the autocomplete menu. Fixes #9771 Closes gh-1184
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/autocomplete/autocomplete_core.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/unit/autocomplete/autocomplete_core.js b/tests/unit/autocomplete/autocomplete_core.js
index 961aca400..81d534cb8 100644
--- a/tests/unit/autocomplete/autocomplete_core.js
+++ b/tests/unit/autocomplete/autocomplete_core.js
@@ -163,6 +163,32 @@ test( "allow form submit on enter when menu is not active", function() {
}
})();
+asyncTest( "past end of menu in multiline autocomplete", function() {
+ expect( 2 );
+
+ var customVal = "custom value",
+ element = $( "#autocomplete-contenteditable" ).autocomplete({
+ delay: 0,
+ source: [ "javascript" ],
+ focus: function( event, ui ) {
+ equal( ui.item.value, "javascript", "Item gained focus" );
+ $( this ).text( customVal );
+ event.preventDefault();
+ }
+ });
+
+ element
+ .simulate( "focus" )
+ .autocomplete( "search", "ja" );
+
+ setTimeout(function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ equal( element.text(), customVal );
+ start();
+ }, 50 );
+});
+
asyncTest( "handle race condition", function() {
expect( 3 );
var count = 0,