aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/selectmenu
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2014-08-22 16:40:09 -0400
committerAlexander Schmitz <arschmitz@gmail.com>2015-10-07 10:57:59 -0400
commit9f7f0a427966741a460e91336947698879f8ad77 (patch)
treea7e34fd8a735149dc684b08e7fec087db4f886d7 /tests/unit/selectmenu
parent897ec38e6327393e8bac197a66e5c54bf883600f (diff)
downloadjquery-ui-9f7f0a427966741a460e91336947698879f8ad77.tar.gz
jquery-ui-9f7f0a427966741a460e91336947698879f8ad77.zip
Selectmenu: update to use button css
This ensures consistency between different form elements
Diffstat (limited to 'tests/unit/selectmenu')
-rw-r--r--tests/unit/selectmenu/core.js13
-rw-r--r--tests/unit/selectmenu/methods.js12
-rw-r--r--tests/unit/selectmenu/selectmenu.html4
3 files changed, 15 insertions, 14 deletions
diff --git a/tests/unit/selectmenu/core.js b/tests/unit/selectmenu/core.js
index 5431d689d..021f9b28a 100644
--- a/tests/unit/selectmenu/core.js
+++ b/tests/unit/selectmenu/core.js
@@ -6,7 +6,7 @@ define( [
module( "selectmenu: core" );
test( "markup structure", function( assert ) {
- expect( 4 );
+ expect( 5 );
var element = $( "#files" ).selectmenu(),
button = element.selectmenu( "widget" ),
@@ -16,6 +16,7 @@ test( "markup structure", function( assert ) {
assert.hasClasses( button,
"ui-selectmenu-button ui-selectmenu-button-closed ui-widget" );
assert.lacksClasses( button, "ui-selectmenu-button-open" );
+ assert.lacksClasses( button, "ui-selectmenu-open" );
assert.hasClasses( menuWrap, "ui-selectmenu-menu" );
assert.lacksClasses( menuWrap, "ui-selectmenu-menu-open" );
} );
@@ -89,7 +90,7 @@ test( "_renderButtonItem()", function() {
element.selectmenu( "refresh" );
option = element.find( "option:selected" );
equal(
- option.text() + element[ 0 ].selectedIndex,
+ " " + option.text() + element[ 0 ].selectedIndex,
button.text(),
"refresh: button item text"
);
@@ -98,7 +99,7 @@ test( "_renderButtonItem()", function() {
menu.find( "li" ).last().simulate( "mouseover" ).trigger( "click" );
option = element.find( "option" ).last();
equal(
- option.text() + element[ 0 ].selectedIndex,
+ " " + option.text() + element[ 0 ].selectedIndex,
button.text(),
"click: button item text"
);
@@ -146,7 +147,7 @@ $.each( [
selected.val(),
"original select state"
);
- equal( button.text(), selected.text(), "button text" );
+ equal( button.text(), " " + selected.text(), "button text" );
start();
} );
} );
@@ -181,7 +182,7 @@ $.each( [
selected.val(),
"original select state"
);
- equal( button.text(), selected.text(), "button text" );
+ equal( button.text(), " " + selected.text(), "button text" );
start();
}, 1 );
} );
@@ -222,7 +223,7 @@ $.each( [
"button aria-activedescendant" );
equal( element.find( "option:selected" ).val(), options.eq( 1 ).val(),
"original select state" );
- equal( button.text(), options.eq( 1 ).text(), "button text" );
+ equal( button.text(), " " + options.eq( 1 ).text(), "button text" );
start();
} );
} );
diff --git a/tests/unit/selectmenu/methods.js b/tests/unit/selectmenu/methods.js
index e49da50f5..7007abe83 100644
--- a/tests/unit/selectmenu/methods.js
+++ b/tests/unit/selectmenu/methods.js
@@ -81,21 +81,21 @@ asyncTest( "refresh - change selected option", function() {
var element = $( "#speed" ).selectmenu(),
button = element.selectmenu( "widget" );
- equal( element.find( "option:selected" ).text(), button.text(), "button text after init" );
+ equal( button.text(), " Medium", "button text after init" );
button.simulate( "focus" );
+
setTimeout( function() {
- equal( element.find( "option:selected" ).text(), button.text(), "button text after focus" );
+ equal( button.text(), " Medium", "button text after focus" );
element[ 0 ].selectedIndex = 0;
element.selectmenu( "refresh" );
- equal( element.find( "option:selected" ).text(), button.text(),
- "button text after changing selected option" );
+ equal( button.text(), " Slower", "button text after changing selected option" );
element.find( "option" ).prop( "selected", false );
element.append( "<option selected value=\"selected_option\">Selected option</option>" );
element.selectmenu( "refresh" );
- equal( "Selected option", button.text(), "button text after adding selected option" );
+ equal( button.text(), " Selected option", "button text after adding selected option" );
start();
} );
@@ -180,7 +180,7 @@ test( "widget and menuWidget", function( assert ) {
menu = element.selectmenu( "menuWidget" );
equal( button.length, 1, "button: one element" );
- assert.hasClasses( button, "ui-selectmenu-button" );
+ assert.hasClasses( button, "ui-button" );
equal( menu.length, 1, "Menu Widget: one element" );
ok( menu.is( "ul.ui-menu" ), "Menu Widget: element and class" );
diff --git a/tests/unit/selectmenu/selectmenu.html b/tests/unit/selectmenu/selectmenu.html
index 16e0f15a7..14a6c8087 100644
--- a/tests/unit/selectmenu/selectmenu.html
+++ b/tests/unit/selectmenu/selectmenu.html
@@ -3,10 +3,10 @@
<head>
<meta charset="utf-8">
<title>jQuery UI Selectmenu Test Suite</title>
-
<script src="../../../external/requirejs/require.js"></script>
- <script src="../../lib/css.js" data-modules="core menu selectmenu"></script>
+ <script src="../../lib/css.js" data-modules="core menu selectmenu button"></script>
<script src="../../lib/bootstrap.js" data-widget="selectmenu"></script>
+
</head>
<body>