aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-12-18 19:00:32 +0100
committerFelix Nagel <info@felixnagel.com>2013-12-18 19:05:17 +0100
commit0cc855407792d6501ded6e61ba45efb09d002810 (patch)
tree12c3658d526e8f958b344adaa231320df9b9bc3d /tests/unit
parentbc8e75059c7a222ede8f5fddd88098581e5ee3ce (diff)
downloadjquery-ui-0cc855407792d6501ded6e61ba45efb09d002810.tar.gz
jquery-ui-0cc855407792d6501ded6e61ba45efb09d002810.zip
Selectmenu Tests: add unit tests for empty options
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/selectmenu/selectmenu_core.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/unit/selectmenu/selectmenu_core.js b/tests/unit/selectmenu/selectmenu_core.js
index 60c350eb3..551cda407 100644
--- a/tests/unit/selectmenu/selectmenu_core.js
+++ b/tests/unit/selectmenu/selectmenu_core.js
@@ -230,6 +230,38 @@ $.each([
equal( activeItem.attr( "id" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "selected item has ui-state-active class" );
}
});
+
+ asyncTest( "empty option - " + settings.type, function () {
+ expect( 7 );
+
+ var element = $( settings.selector ),
+ button, menu, links, link;
+
+ element.find( "option" ).first().text( "" );
+ element.selectmenu();
+ button = element.selectmenu( "widget" );
+ menu = element.selectmenu( "menuWidget" );
+
+ // init menu
+ button.simulate( "focus" );
+
+ setTimeout(function() {
+ links = menu.find( "li:not(.ui-selectmenu-optgroup)" );
+ link = links.first();
+
+ button.trigger( "click" );
+
+ equal( links.length, element.find( "option" ).length, "correct amount of list elements" );
+ ok( link.outerHeight() > 10, "empty item seems to have reasonable height" );
+ ok( link.attr( "id" ), "empty item has id attribute" );
+ ok( link.hasClass( "ui-menu-item" ), "empty item has ui-menu-item class" );
+ ok( !link.hasClass( "ui-menu-divider" ), "empty item has not ui-menu-divider class" );
+ equal( link.attr( "tabindex" ), -1, "empty item has tabindex" );
+ equal( link.attr( "role" ), "option", "empty item has role option" );
+
+ start();
+ }, 1 );
+ });
});
})( jQuery );