mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Autocomplete: Added test for close method.
This commit is contained in:
parent
66c7dfd377
commit
62a70da959
@ -162,8 +162,4 @@ test( "allow form submit on enter when menu is not active", function() {
|
||||
}
|
||||
})();
|
||||
|
||||
(function() {
|
||||
|
||||
})();
|
||||
|
||||
}( jQuery ) );
|
||||
|
@ -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 ) );
|
||||
|
Loading…
Reference in New Issue
Block a user