Permalink
Browse files

Selectmenu: Correctly update checkboxes in non-native multiselect list

(cherry picked from commit dca863f)

Closes gh-7774
Fixes gh-7732
  • Loading branch information...
1 parent 7b97a67 commit c4fb16a4321dfe430ca010737ff4b45025404bfb Ian Maffett committed with gabrielschulhof Oct 13, 2014
Showing with 18 additions and 3 deletions.
  1. +4 −3 js/widgets/forms/select.custom.js
  2. +14 −0 tests/unit/select/select_core.js
@@ -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 );
@@ -348,6 +346,9 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
}
}
}
+ else if ( self.isMultiple ) {
+ item.find( "a" ).removeClass( "ui-checkbox-on" ).addClass( "ui-checkbox-off" );
+ }
});
},
@@ -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" );

0 comments on commit c4fb16a

Please sign in to comment.