@@ -230,6 +230,38 @@ $.each([
230
230
equal ( activeItem . attr ( "id" ) , links . eq ( element [ 0 ] . selectedIndex ) . attr ( "id" ) , "selected item has ui-state-active class" ) ;
231
231
}
232
232
} ) ;
233
+
234
+ asyncTest ( "empty option - " + settings . type , function ( ) {
235
+ expect ( 7 ) ;
236
+
237
+ var element = $ ( settings . selector ) ,
238
+ button , menu , links , link ;
239
+
240
+ element . find ( "option" ) . first ( ) . text ( "" ) ;
241
+ element . selectmenu ( ) ;
242
+ button = element . selectmenu ( "widget" ) ;
243
+ menu = element . selectmenu ( "menuWidget" ) ;
244
+
245
+ // init menu
246
+ button . simulate ( "focus" ) ;
247
+
248
+ setTimeout ( function ( ) {
249
+ links = menu . find ( "li:not(.ui-selectmenu-optgroup)" ) ;
250
+ link = links . first ( ) ;
251
+
252
+ button . trigger ( "click" ) ;
253
+
254
+ equal ( links . length , element . find ( "option" ) . length , "correct amount of list elements" ) ;
255
+ ok ( link . outerHeight ( ) > 10 , "empty item seems to have reasonable height" ) ;
256
+ ok ( link . attr ( "id" ) , "empty item has id attribute" ) ;
257
+ ok ( link . hasClass ( "ui-menu-item" ) , "empty item has ui-menu-item class" ) ;
258
+ ok ( ! link . hasClass ( "ui-menu-divider" ) , "empty item has not ui-menu-divider class" ) ;
259
+ equal ( link . attr ( "tabindex" ) , - 1 , "empty item has tabindex" ) ;
260
+ equal ( link . attr ( "role" ) , "option" , "empty item has role option" ) ;
261
+
262
+ start ( ) ;
263
+ } , 1 ) ;
264
+ } ) ;
233
265
} ) ;
234
266
235
267
} ) ( jQuery ) ;
0 commit comments