Skip to content

Commit 4434822

Browse files
author
Gabriel Schulhof
committed
Selectmenu: Correctly pass theme and overlayTheme to popup
Closes jquery-archivegh-7196 Fixes jquery-archivegh-7195
1 parent 9ff610d commit 4434822

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

js/widgets/forms/select.custom.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
162162
"</div>"+
163163
"<div data-" + $.mobile.ns + "role='content'></div>"+
164164
"</div>" );
165-
listbox = $( "<div id='" + popupId + "' class='ui-selectmenu'></div>" ).insertAfter( this.select ).popup({ theme: o.overlayTheme });
165+
listbox = $( "<div" + themeAttr + overlayThemeAttr + " id='" + popupId +
166+
"' class='ui-selectmenu'></div>" )
167+
.insertAfter( this.select )
168+
.popup();
166169
list = $( "<ul class='ui-selectmenu-list' id='" + menuId + "' role='listbox' aria-labelledby='" + this.buttonId + "'" + themeAttr + dividerThemeAttr + "></ul>" ).appendTo( listbox );
167170
header = $( "<div class='ui-header ui-bar-" + ( o.theme ? o.theme : "inherit" ) + "'></div>" ).prependTo( listbox );
168171
headerTitle = $( "<h1 class='ui-title'></h1>" ).appendTo( header );

tests/unit/select/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
<div data-nstest-role="page">
3535
<div data-nstest-role="content">
3636
<div data-role="fieldcontain">
37-
<label for="role-test">Multiple:</label>
38-
<select name="role-test" id="role-test" multiple="multiple" data-nstest-native-menu="false">
37+
<label for="enhance-test">Multiple:</label>
38+
<select name="enhance-test" id="enhance-test" multiple="multiple" data-nstest-native-menu="false" data-nstest-overlay-theme="b" data-nstest-theme="x">
3939
<option>Choose options</option>
4040
<option value="1">The 1st Option</option>
4141
<option value="2" selected="selected">The 2nd Option</option>

tests/unit/select/select_core.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
module( "Custom select" );
88

99
test( "Custom select is enhanced correctly", function() {
10-
deepEqual( $( "#role-test-listbox a:first" ).attr( "role" ), "button", "The close button for a multiple choice select popup has the " + '"' + "role='button'" + '"' + " set" );
10+
var popup = $( "#enhance-test-listbox" );
11+
12+
deepEqual( $( "#enhance-test-listbox a:first" ).attr( "role" ), "button", "The close button for a multiple choice select popup has the " + '"' + "role='button'" + '"' + " set" );
13+
deepEqual( popup.popup( "option", "overlayTheme" ), "b", "Popup has overlayTheme b" );
14+
deepEqual( popup.popup( "option", "theme" ), "x", "Popup has theme x" );
1115
});
1216

1317
module( "Native select" );
1418

1519
test( "Select menu ID", function() {
1620
ok( $( ".no-id-test" ).closest( ".ui-btn" ).attr( "id" ) !== "undefined-button", "Select menu without an ID does not result in the button having name 'undefined-button'" );
1721
});
18-
1922
})(jQuery);

0 commit comments

Comments
 (0)