aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/autocomplete/autocomplete_methods.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-06-13 14:09:44 -0400
committerScott González <scott.gonzalez@gmail.com>2011-06-13 14:09:44 -0400
commit2bc66279912b460f572abff0d502e8e2c9c285a7 (patch)
tree7e98e13c905e72b5e92e77d4583aa82f5cd2af48 /tests/unit/autocomplete/autocomplete_methods.js
parentba9bd20c0d5a6ede11a536da9024bb1a582d131f (diff)
downloadjquery-ui-2bc66279912b460f572abff0d502e8e2c9c285a7.tar.gz
jquery-ui-2bc66279912b460f572abff0d502e8e2c9c285a7.zip
Autocomplete tests: Cleanup.
Diffstat (limited to 'tests/unit/autocomplete/autocomplete_methods.js')
-rw-r--r--tests/unit/autocomplete/autocomplete_methods.js55
1 files changed, 23 insertions, 32 deletions
diff --git a/tests/unit/autocomplete/autocomplete_methods.js b/tests/unit/autocomplete/autocomplete_methods.js
index 1043e47ba..3fe035d28 100644
--- a/tests/unit/autocomplete/autocomplete_methods.js
+++ b/tests/unit/autocomplete/autocomplete_methods.js
@@ -1,39 +1,30 @@
-/*
- * autocomplete_methods.js
- */
-(function($) {
+(function( $ ) {
+module( "autocomplete: methods" );
-module("autocomplete: methods", {
- teardown: function() {
- $( ":ui-autocomplete" ).autocomplete( "destroy" );
- }
+test( "destroy", function() {
+ expect( 1 );
+ domEqual( "#autocomplete", function() {
+ $( "#autocomplete" ).autocomplete().autocomplete( "destroy" );
+ });
});
-test("destroy", function() {
- domEqual("#autocomplete", function() {
- $("#autocomplete").autocomplete().autocomplete("destroy");
- });
-})
+test( "search", function() {
+ expect( 3 );
+ var data = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl" ],
+ element = $( "#autocomplete" ).autocomplete({
+ source: data,
+ minLength: 0
+ }),
+ menu = element.autocomplete( "widget" );
+ element.autocomplete( "search" );
+ equal( menu.find( ".ui-menu-item" ).length, data.length, "all items for a blank search" );
-var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];
+ element.val( "has" ).autocomplete( "search" );
+ equal( menu.find( ".ui-menu-item" ).text(), "haskell", "only one item for set input value" );
-test("search", function() {
- var ac = $("#autocomplete").autocomplete({
- source: data,
- minLength: 0
- });
- ac.autocomplete("search");
- same( $(".ui-menu .ui-menu-item").length, data.length, "all items for a blank search" );
-
- ac.val("has");
- ac.autocomplete("search")
- same( $(".ui-menu .ui-menu-item").text(), "haskell", "only one item for set input value" );
-
- ac.autocomplete("search", "ja");
- same( $(".ui-menu .ui-menu-item").length, 2, "only java and javascript for 'ja'" );
-
- $("#autocomplete").autocomplete("destroy");
-})
+ element.autocomplete( "search", "ja" );
+ equal( menu.find( ".ui-menu-item" ).length, 2, "only java and javascript for 'ja'" );
+});
-})(jQuery);
+}( jQuery ) );