aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/autocomplete/autocomplete_options.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2014-01-20 16:13:55 -0500
committerScott González <scott.gonzalez@gmail.com>2014-01-20 16:20:11 -0500
commit2ef1b16e4d3aa8766084e50f4a1d806c434e7e43 (patch)
tree4764e734127d6e36e1d615bf1363090532814de1 /tests/unit/autocomplete/autocomplete_options.js
parent0bb807bb42af87bf4c6dd4d71808b12c08d316e7 (diff)
downloadjquery-ui-2ef1b16e4d3aa8766084e50f4a1d806c434e7e43.tar.gz
jquery-ui-2ef1b16e4d3aa8766084e50f4a1d806c434e7e43.zip
Autocomplete: Fall back to .ui-front searching for empty jQuery objects
Fixes #9755
Diffstat (limited to 'tests/unit/autocomplete/autocomplete_options.js')
-rw-r--r--tests/unit/autocomplete/autocomplete_options.js37
1 files changed, 26 insertions, 11 deletions
diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js
index e6f08785b..fee37aee4 100644
--- a/tests/unit/autocomplete/autocomplete_options.js
+++ b/tests/unit/autocomplete/autocomplete_options.js
@@ -5,13 +5,18 @@ module( "autocomplete: options" );
var data = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby",
"python", "c", "scala", "groovy", "haskell", "perl" ];
-test( "appendTo", function() {
- expect( 8 );
- var detached = $( "<div>" ),
- element = $( "#autocomplete" ).autocomplete();
+test( "appendTo: null", function() {
+ expect( 1 );
+ var element = $( "#autocomplete" ).autocomplete();
equal( element.autocomplete( "widget" ).parent()[ 0 ], document.body,
"defaults to body" );
element.autocomplete( "destroy" );
+});
+
+test( "appendTo: explicit", function() {
+ expect( 6 );
+ var detached = $( "<div>" ),
+ element = $( "#autocomplete" );
element.autocomplete({
appendTo: ".autocomplete-wrap"
@@ -22,13 +27,6 @@ test( "appendTo", function() {
"only appends to one element" );
element.autocomplete( "destroy" );
- $( "#autocomplete-wrap2" ).addClass( "ui-front" );
- element.autocomplete();
- equal( element.autocomplete( "widget" ).parent()[ 0 ],
- $( "#autocomplete-wrap2" )[ 0 ], "null, inside .ui-front" );
- element.autocomplete( "destroy" );
- $( "#autocomlete-wrap2" ).removeClass( "ui-front" );
-
element.autocomplete().autocomplete( "option", "appendTo", "#autocomplete-wrap1" );
equal( element.autocomplete( "widget" ).parent()[ 0 ],
$( "#autocomplete-wrap1" )[ 0 ], "modified after init" );
@@ -54,6 +52,23 @@ test( "appendTo", function() {
element.autocomplete( "destroy" );
});
+test( "appendTo: ui-front", function() {
+ expect( 2 );
+ var element = $( "#autocomplete" );
+
+ $( "#autocomplete-wrap2" ).addClass( "ui-front" );
+ element.autocomplete();
+ equal( element.autocomplete( "widget" ).parent()[ 0 ],
+ $( "#autocomplete-wrap2" )[ 0 ], "null, inside .ui-front" );
+ element.autocomplete( "destroy" );
+
+ element.autocomplete({
+ appendTo: $()
+ });
+ equal( element.autocomplete( "widget" ).parent()[ 0 ],
+ $( "#autocomplete-wrap2" )[ 0 ], "null, inside .ui-front" );
+});
+
function autoFocusTest( afValue, focusedLength ) {
var element = $( "#autocomplete" ).autocomplete({
autoFocus: afValue,