aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/selectmenu
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2014-07-28 19:09:41 +0200
committerScott González <scott.gonzalez@gmail.com>2014-11-04 08:02:48 -0500
commitfb4124b7af4e87712eca9893f7aefb5fee7905de (patch)
treede6eab0c8eb5699ec37c45e7a6f9da2d22bef1f4 /tests/unit/selectmenu
parente6484470f095efd8918231f433eabe14ebd002fd (diff)
downloadjquery-ui-fb4124b7af4e87712eca9893f7aefb5fee7905de.tar.gz
jquery-ui-fb4124b7af4e87712eca9893f7aefb5fee7905de.zip
Selectmenu: Introduce _renderButtonItem() method
Fixes #10142 Closes gh-1299
Diffstat (limited to 'tests/unit/selectmenu')
-rw-r--r--tests/unit/selectmenu/selectmenu_core.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/unit/selectmenu/selectmenu_core.js b/tests/unit/selectmenu/selectmenu_core.js
index 0074c6f90..2ee963043 100644
--- a/tests/unit/selectmenu/selectmenu_core.js
+++ b/tests/unit/selectmenu/selectmenu_core.js
@@ -45,6 +45,40 @@ asyncTest( "accessibility", function() {
});
+test( "_renderButtonItem()", function() {
+ expect( 2 );
+
+ var option,
+ element = $( "#speed" ).selectmenu(),
+ instance = element.selectmenu( "instance" ),
+ button = element.selectmenu( "widget" ),
+ menu = element.selectmenu( "menuWidget" );
+
+ instance._renderButtonItem = function( item ) {
+ var buttonItem = $( "<span>" );
+ this._setText( buttonItem, item.label + item.index );
+
+ return buttonItem;
+ };
+
+ element.selectmenu( "refresh" );
+ option = element.find( "option:selected" );
+ equal(
+ option.text() + element[ 0 ].selectedIndex,
+ button.text(),
+ "refresh: button item text"
+ );
+
+ button.trigger( "click" );
+ menu.find( "li" ).last().simulate( "mouseover" ).trigger( "click" );
+ option = element.find( "option" ).last();
+ equal(
+ option.text() + element[ 0 ].selectedIndex,
+ button.text(),
+ "click: button item text"
+ );
+});
+
$.each([
{
type: "default",