@@ -102,6 +102,39 @@ test( "minLength", function() {
102
102
ok ( menu . is ( ":visible" ) , "blank enough for minLength: 0" ) ;
103
103
} ) ;
104
104
105
+ asyncTest ( "minLength, exceed then drop below" , function ( ) {
106
+ expect ( 4 ) ;
107
+ var element = $ ( "#autocomplete" ) . autocomplete ( {
108
+ minLength : 2 ,
109
+ source : function ( req , res ) {
110
+ equal ( req . term , "12" , "correct search term" ) ;
111
+ setTimeout ( function ( ) {
112
+ res ( [ "item" ] ) ;
113
+ } , 1 ) ;
114
+ }
115
+ } ) ,
116
+ menu = element . autocomplete ( "widget" ) ;
117
+
118
+ ok ( menu . is ( ":hidden" ) , "menu is hidden before first search" ) ;
119
+ element . autocomplete ( "search" , "12" ) ;
120
+
121
+ ok ( menu . is ( ":hidden" ) , "menu is hidden before second search" ) ;
122
+ element . autocomplete ( "search" , "1" ) ;
123
+
124
+ setTimeout ( function ( ) {
125
+ ok ( menu . is ( ":hidden" ) , "menu is hidden after searches" ) ;
126
+ start ( ) ;
127
+ } , 50 ) ;
128
+ } ) ;
129
+
130
+ // TODO: figure out how to implement this test
131
+ // When fixing #7523, I couldn't figure out a test that would fail when
132
+ // calling .close() (instead of ._close()) from ._response().
133
+ // Use the remote demo and type "je", delete, "a", you should get results for "ja"
134
+ // but if we call .close() from ._response() the results are ignored.
135
+ //asyncTest( "minLength, exceed then drop below", function() {
136
+ //});
137
+
105
138
test ( "source, local string array" , function ( ) {
106
139
expect ( 1 ) ;
107
140
var element = $ ( "#autocomplete" ) . autocomplete ( {
0 commit comments