Skip to content

Commit ab24dd4

Browse files
author
Gabriel Schulhof
committed
Selectmenu: Heed dividerTheme if there are optgroup children
Fixes jquery-archivegh-7080 Closes jquery-archivegh-7945
1 parent 4298089 commit ab24dd4

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

js/widgets/forms/select.custom.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
196196
overlayTheme = o.overlayTheme || o.theme || null;
197197
overlayThemeAttr = overlayTheme ? ( " data-" + $.mobile.ns +
198198
"overlay-theme='" + overlayTheme + "'" ) : "";
199-
dividerThemeAttr = ( o.dividerTheme && isMultiple ) ? ( " data-" + $.mobile.ns + "divider-theme='" + o.dividerTheme + "'" ) : "";
199+
dividerThemeAttr = ( o.dividerTheme && this.element.children( "optgroup" ).length > 0 ) ?
200+
( " data-" + $.mobile.ns + "divider-theme='" + o.dividerTheme + "'" ) : "";
200201
menuPage = $( "<div data-" + $.mobile.ns + "role='dialog' class='ui-selectmenu'" +
201202
themeAttr + overlayThemeAttr + ">" +
202203
"<div data-" + $.mobile.ns + "role='header'>" +

tests/integration/select/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@
533533
</select>
534534

535535
<div data-nstest-role="fieldcontain" id="optgroup-and-placeholder-container">
536-
<select name="optgroup-and-placeholder" id="optgroup-and-placeholder" data-nstest-native-menu="false">
536+
<select name="optgroup-and-placeholder" data-nstest-divider-theme="b" id="optgroup-and-placeholder" data-nstest-native-menu="false">
537537
<option>Choose shipping method</option>
538538
<optgroup label="USPS">
539539
<option value="standard" selected>Standard: 7 day</option>

tests/integration/select/select_core.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@
4141
});
4242

4343
asyncTest( "placeholder correctly gets ui-screen-hidden class after rebuilding", function() {
44+
expect( 3 );
45+
4446
$.testHelper.sequence( [
4547
function() {
4648
// bring up the optgroup menu
4749
ok( $( "#optgroup-and-placeholder-container a" ).length > 0, "there is in fact a button in the page" );
50+
deepEqual( $( "#optgroup-and-placeholder-menu li.ui-li-divider" )
51+
.first().hasClass( "ui-bar-b" ), true, "Optgroup header has swatch b" );
4852
$( "#optgroup-and-placeholder-container a" ).trigger( "click" );
4953
},
5054

0 commit comments

Comments
 (0)