Skip to content

Commit

Permalink
Selectmenu: Correctly update checkboxes in non-native multiselect list
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Maffett authored and agcolom committed Nov 26, 2014
1 parent b573963 commit 8c19530
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/widgets/forms/select.custom.js
Expand Up @@ -330,10 +330,8 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
.find( "a" ).removeClass( $.mobile.activeBtnClass ).end()
.attr( "aria-selected", false )
.each(function( i ) {

var item = $( this );
if ( $.inArray( i, indices ) > -1 ) {
var item = $( this );

// Aria selected attr
item.attr( "aria-selected", true );

Expand All @@ -348,6 +346,9 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
}
}
}
else if ( self.isMultiple ) {
item.find( "a" ).removeClass( "ui-checkbox-on" ).addClass( "ui-checkbox-off" );
}
});
},

Expand Down
14 changes: 14 additions & 0 deletions tests/unit/select/select_core.js
Expand Up @@ -25,6 +25,20 @@
deepEqual( $( "#enhance-test-listbox a:first" ).attr( "role" ), "button", "The close button for a multiple choice select popup has the " + '"' + "role='button'" + '"' + " set" );
deepEqual( popup.popup( "option", "overlayTheme" ), "b", "Popup has overlayTheme b" );
deepEqual( popup.popup( "option", "theme" ), "x", "Popup has theme x" );

});

module( "Custom select Multiple" );

test( "Custom select multiple is cleared correctly", function() {
var popup = $( "#enhance-test-listbox" );
$("#enhance-test")
.find("option")
.attr("selected", false)
.prop("selected", false)
.end()
.selectmenu("refresh");
deepEqual(popup.find(".ui-checkbox-on").length,0,"Checkboxes should not have ui-checkbox-on class");
});

module( "Native select" );
Expand Down

0 comments on commit 8c19530

Please sign in to comment.