Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Selectmenu: Heed dividerTheme if there are optgroup children
Browse files Browse the repository at this point in the history
Fixes gh-7080
Closes gh-7945
  • Loading branch information
Gabriel Schulhof committed Feb 5, 2015
1 parent 4298089 commit ab24dd4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion js/widgets/forms/select.custom.js
Expand Up @@ -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'>" +
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/select/index.html
Expand Up @@ -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>
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/select/select_core.js
Expand Up @@ -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" );
},

Expand Down

0 comments on commit ab24dd4

Please sign in to comment.