Permalink
Browse files

Selectmenu: Heed dividerTheme if there are optgroup children

Fixes gh-7080
Closes gh-7945
  • Loading branch information...
gabrielschulhof committed Jan 27, 2015
1 parent 4298089 commit ab24dd41c0d835be3d10bb700cb3767d79d1a766
@@ -196,7 +196,8 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
overlayTheme = o.overlayTheme || o.theme || null;
overlayThemeAttr = overlayTheme ? ( " data-" + $.mobile.ns +
"overlay-theme='" + overlayTheme + "'" ) : "";
dividerThemeAttr = ( o.dividerTheme && isMultiple ) ? ( " data-" + $.mobile.ns + "divider-theme='" + o.dividerTheme + "'" ) : "";
dividerThemeAttr = ( o.dividerTheme && this.element.children( "optgroup" ).length > 0 ) ?
( " data-" + $.mobile.ns + "divider-theme='" + o.dividerTheme + "'" ) : "";
menuPage = $( "<div data-" + $.mobile.ns + "role='dialog' class='ui-selectmenu'" +
themeAttr + overlayThemeAttr + ">" +
"<div data-" + $.mobile.ns + "role='header'>" +
@@ -533,7 +533,7 @@
</select>
<div data-nstest-role="fieldcontain" id="optgroup-and-placeholder-container">
<select name="optgroup-and-placeholder" id="optgroup-and-placeholder" data-nstest-native-menu="false">
<select name="optgroup-and-placeholder" data-nstest-divider-theme="b" id="optgroup-and-placeholder" data-nstest-native-menu="false">
<option>Choose shipping method</option>
<optgroup label="USPS">
<option value="standard" selected>Standard: 7 day</option>
@@ -41,10 +41,14 @@
});
asyncTest( "placeholder correctly gets ui-screen-hidden class after rebuilding", function() {
expect( 3 );
$.testHelper.sequence( [
function() {
// bring up the optgroup menu
ok( $( "#optgroup-and-placeholder-container a" ).length > 0, "there is in fact a button in the page" );
deepEqual( $( "#optgroup-and-placeholder-menu li.ui-li-divider" )
.first().hasClass( "ui-bar-b" ), true, "Optgroup header has swatch b" );
$( "#optgroup-and-placeholder-container a" ).trigger( "click" );
},

0 comments on commit ab24dd4

Please sign in to comment.