From ab24dd41c0d835be3d10bb700cb3767d79d1a766 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Tue, 27 Jan 2015 23:11:25 +0200 Subject: [PATCH] Selectmenu: Heed dividerTheme if there are optgroup children Fixes gh-7080 Closes gh-7945 --- js/widgets/forms/select.custom.js | 3 ++- tests/integration/select/index.html | 2 +- tests/integration/select/select_core.js | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/js/widgets/forms/select.custom.js b/js/widgets/forms/select.custom.js index d7a7e43c5bf..2d9d8043f1b 100644 --- a/js/widgets/forms/select.custom.js +++ b/js/widgets/forms/select.custom.js @@ -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 = $( "
" + "
" + diff --git a/tests/integration/select/index.html b/tests/integration/select/index.html index 47cd1e439d1..a468f129827 100644 --- a/tests/integration/select/index.html +++ b/tests/integration/select/index.html @@ -533,7 +533,7 @@
- diff --git a/tests/integration/select/select_core.js b/tests/integration/select/select_core.js index 1b4ed700b3a..1d236a2d783 100644 --- a/tests/integration/select/select_core.js +++ b/tests/integration/select/select_core.js @@ -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" ); },