]> source.dussan.org Git - jquery-ui.git/commitdiff
autocomplete: added init/destroy tests
authorPaul Bakaus <paul.bakaus@googlemail.com>
Wed, 30 Jul 2008 18:13:58 +0000 (18:13 +0000)
committerPaul Bakaus <paul.bakaus@googlemail.com>
Wed, 30 Jul 2008 18:13:58 +0000 (18:13 +0000)
tests/autocomplete.html
tests/autocomplete.js

index 86d77e228e6ea9c4868dbf1fa0d1f6e8a77f8252..609e536f880b9503fc1ab54d5953180c51a53ff3 100644 (file)
@@ -19,6 +19,8 @@
 <h1>jQuery - Autocomplete Test Suite</h1>
 <div id="main" style="display: none">
        
+       <input type="text" name="autocomplete" value="" id="autocomplete">
+       
 </div>
 
 <ol id="tests"></ol>
index b3d36cb5a3afd4424c1b841be1f7de0104d12766..2196e96f9ef6c603c5a19f7ea13656aeb8b9ddae 100644 (file)
@@ -1,3 +1,48 @@
+test("init", function() {\r
+       expect(6);\r
+\r
+       el = $("#autocomplete").autocomplete();\r
+       ok(true, '.autocomplete() called on element');\r
+\r
+       $([]).autocomplete();\r
+       ok(true, '.autocomplete() called on empty collection');\r
+\r
+       $("<input/>").autocomplete();\r
+       ok(true, '.autocomplete() called on disconnected DOMElement');\r
+\r
+       $("<input/>").autocomplete().autocomplete("foo");\r
+       ok(true, 'arbitrary method called after init');\r
+\r
+       $("<input/>").autocomplete().data("foo.autocomplete");\r
+       ok(true, 'arbitrary option getter after init');\r
+\r
+       $("<input/>").autocomplete().data("foo.autocomplete", "bar");\r
+       ok(true, 'arbitrary option setter after init');\r
+});\r
+\r
+test("destroy", function() {\r
+       expect(6);\r
+\r
+       $("#autocomplete").autocomplete().autocomplete("destroy");      \r
+       ok(true, '.autocomplete("destroy") called on element');\r
+\r
+       $([]).autocomplete().autocomplete("destroy");\r
+       ok(true, '.autocomplete("destroy") called on empty collection');\r
+\r
+       $("<input/>").autocomplete().autocomplete("destroy");\r
+       ok(true, '.autocomplete("destroy") called on disconnected DOMElement');\r
+\r
+       $("<input/>").autocomplete().autocomplete("destroy").autocomplete("foo");\r
+       ok(true, 'arbitrary method called after destroy');\r
+\r
+       $("<input/>").autocomplete().autocomplete("destroy").data("foo.autocomplete");\r
+       ok(true, 'arbitrary option getter after destroy');\r
+\r
+       $("<input/>").autocomplete().autocomplete("destroy").data("foo.autocomplete", "bar");\r
+       ok(true, 'arbitrary option setter after destroy');\r
+});\r
+\r
+\r
 test("highlighter", function() {\r
        equals( jQuery.Autocompleter.defaults.highlight("Peter", "Pe"), "<strong>Pe</strong>ter" );\r
        equals( jQuery.Autocompleter.defaults.highlight("Peter <em>&lt;Pan&gt;</em>", "Pe"), "<strong>Pe</strong>ter <em>&lt;Pan&gt;</em>" );\r