aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/autocomplete/autocomplete_options.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-07-21 14:54:20 -0400
committerScott González <scott.gonzalez@gmail.com>2010-07-21 14:54:20 -0400
commit74e0d4f47301ff854ec741434da1351544a1a55d (patch)
tree4e1f72f466b488f3964824c0cf37fddc118e6278 /tests/unit/autocomplete/autocomplete_options.js
parent245b93293335e916771aa78363e83f244b43de7a (diff)
downloadjquery-ui-74e0d4f47301ff854ec741434da1351544a1a55d.tar.gz
jquery-ui-74e0d4f47301ff854ec741434da1351544a1a55d.zip
Autocomplete: Added appendTo option. Fixes #5836 - Autocomplete: add appendTo option.
Diffstat (limited to 'tests/unit/autocomplete/autocomplete_options.js')
-rw-r--r--tests/unit/autocomplete/autocomplete_options.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js
index c5aa7c961..ac4aeef35 100644
--- a/tests/unit/autocomplete/autocomplete_options.js
+++ b/tests/unit/autocomplete/autocomplete_options.js
@@ -68,6 +68,36 @@ test("cache: false", function() {
var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];
+test( "appendTo", function() {
+ var ac = $( "#autocomplete" ).autocomplete();
+ same( ac.autocomplete( "widget" ).parent()[0], document.body, "defaults to body" );
+ ac.autocomplete( "destroy" );
+
+ ac.autocomplete({
+ appendTo: "#ac-wrap2"
+ });
+ same( ac.autocomplete( "widget" ).parent()[0], $( "#ac-wrap2" )[0], "id" );
+ ac.autocomplete( "destroy" );
+
+ ac.autocomplete({
+ appendTo: ".ac-wrap"
+ });
+ same( ac.autocomplete( "widget" ).parent()[0], $( "#ac-wrap1" )[0], "class" );
+ same( $( "#ac-wrap2 .ui-autocomplete").length, 0, "class - only appends to one element")
+ ac.autocomplete( "destroy" );
+
+ ac.autocomplete({
+ appendTo: null
+ });
+ same( ac.autocomplete( "widget" ).parent()[0], document.body, "null" );
+ ac.autocomplete( "destroy" );
+
+ ac.autocomplete().autocomplete( "option", "appendTo", "#ac-wrap1" );
+ same( ac.autocomplete( "widget" ).parent()[0], $( "#ac-wrap1" )[0], "modified after init" );
+ ac.autocomplete( "destroy" );
+});
+
+
test("delay", function() {
var ac = $("#autocomplete").autocomplete({
source: data,