mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: Don't render options with the hidden
attribute
Fixes #15098
This commit is contained in:
parent
9a4c057157
commit
a2b25ef6ca
@ -376,4 +376,30 @@ QUnit.test( "Number pad input should change value", function( assert ) {
|
||||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( "Options with hidden attribute should not be rendered", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 1 );
|
||||
|
||||
var button, menu, options,
|
||||
element = $( "#speed" );
|
||||
|
||||
element.find( "option" ).eq( 1 ).prop( "hidden", true );
|
||||
element.selectmenu();
|
||||
button = element.selectmenu( "widget" );
|
||||
menu = element.selectmenu( "menuWidget" );
|
||||
|
||||
button.simulate( "focus" );
|
||||
setTimeout( function() {
|
||||
button.trigger( "click" );
|
||||
options = menu.children()
|
||||
.map( function() {
|
||||
return $( this ).text();
|
||||
} )
|
||||
.get();
|
||||
assert.deepEqual( options, [ "Slower", "Medium", "Fast", "Faster" ], "correct elements" );
|
||||
|
||||
ready();
|
||||
} );
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -656,6 +656,10 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
|
||||
var that = this,
|
||||
data = [];
|
||||
options.each( function( index, item ) {
|
||||
if ( item.hidden ) {
|
||||
return;
|
||||
}
|
||||
|
||||
data.push( that._parseOption( $( item ), index ) );
|
||||
} );
|
||||
this.items = data;
|
||||
|
Loading…
Reference in New Issue
Block a user