Skip to content
Permalink
Browse files

Autocomplete: Added test for close method.

  • Loading branch information
scottgonzalez committed Jan 31, 2012
1 parent 66c7dfd commit 62a70da959e71a2d5c8ecc27548ea38733ec3128
Showing with 9 additions and 6 deletions.
  1. +0 −4 tests/unit/autocomplete/autocomplete_core.js
  2. +9 −2 tests/unit/autocomplete/autocomplete_methods.js
@@ -162,8 +162,4 @@ test( "allow form submit on enter when menu is not active", function() {
}
})();

(function() {

})();

}( jQuery ) );
@@ -9,22 +9,29 @@ test( "destroy", function() {
});
});

test( "search", function() {
expect( 3 );
test( "search, close", function() {
expect( 6 );
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" );

ok( menu.is( ":hidden" ), "menu is hidden on init" );

element.autocomplete( "search" );
ok( menu.is( ":visible" ), "menu is visible after search" );
equal( menu.find( ".ui-menu-item" ).length, data.length, "all items for a blank search" );

element.val( "has" ).autocomplete( "search" );
equal( menu.find( ".ui-menu-item" ).text(), "haskell", "only one item for set input value" );

element.autocomplete( "search", "ja" );
equal( menu.find( ".ui-menu-item" ).length, 2, "only java and javascript for 'ja'" );

element.autocomplete( "close" );
ok( menu.is( ":hidden" ), "menu is hidden after close" );
});

}( jQuery ) );

0 comments on commit 62a70da

Please sign in to comment.
You can’t perform that action at this time.