aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-11-28 10:33:44 -0500
committerScott González <scott.gonzalez@gmail.com>2012-11-28 10:33:59 -0500
commitdec844570fae5edf56876b760b9358fde2ecb5e7 (patch)
treef26cba55944b538152ffb7754cc697f76fe27432 /tests
parente77edc60991dc0d9908e056aa05adc49b9daa7cd (diff)
downloadjquery-ui-dec844570fae5edf56876b760b9358fde2ecb5e7.tar.gz
jquery-ui-dec844570fae5edf56876b760b9358fde2ecb5e7.zip
Autocomplete: When appendTo is a jQuery object or a DOM element, don't search against the document. Fixes #8858 - Autocomplete: Fails when appendTo is detached from the DOM.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/autocomplete/autocomplete_options.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js
index 8331c53d5..d3a25d2fc 100644
--- a/tests/unit/autocomplete/autocomplete_options.js
+++ b/tests/unit/autocomplete/autocomplete_options.js
@@ -5,8 +5,9 @@ module( "autocomplete: options" );
var data = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl" ];
test( "appendTo", function() {
- expect( 5 );
- var element = $( "#autocomplete" ).autocomplete();
+ expect( 7 );
+ var detached = $( "<div>" ),
+ element = $( "#autocomplete" ).autocomplete();
equal( element.autocomplete( "widget" ).parent()[0], document.body, "defaults to body" );
element.autocomplete( "destroy" );
@@ -26,6 +27,18 @@ test( "appendTo", function() {
element.autocomplete().autocomplete( "option", "appendTo", "#ac-wrap1" );
equal( element.autocomplete( "widget" ).parent()[0], $( "#ac-wrap1" )[0], "modified after init" );
element.autocomplete( "destroy" );
+
+ element.autocomplete({
+ appendTo: detached
+ });
+ equal( element.autocomplete( "widget" ).parent()[0], detached[0], "detached jQuery object" );
+ element.autocomplete( "destroy" );
+
+ element.autocomplete({
+ appendTo: detached[0]
+ });
+ equal( element.autocomplete( "widget" ).parent()[0], detached[0], "detached DOM element" );
+ element.autocomplete( "destroy" );
});
function autoFocusTest( afValue, focusedLength ) {