Autocomplete: Added test for close method.

This commit is contained in:
Scott González 2012-01-31 14:21:18 -05:00
parent 66c7dfd377
commit 62a70da959
2 changed files with 9 additions and 6 deletions

View File

@ -162,8 +162,4 @@ test( "allow form submit on enter when menu is not active", function() {
}
})();
(function() {
})();
}( jQuery ) );

View File

@ -9,15 +9,19 @@ 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" );
@ -25,6 +29,9 @@ test( "search", function() {
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 ) );