From: Scott González Date: Wed, 4 Mar 2015 19:27:10 +0000 (-0500) Subject: Selectmenu: Support `width: false` and default to 14em X-Git-Tag: 1.12.0-beta.1~426 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=af4c35df9d1cf4c15d57b3789711026360785831;p=jquery-ui.git Selectmenu: Support `width: false` and default to 14em `width: null` still matches the width of the original element. `width: false` prevents an inline style from being set for the width. This makes it easy to set the width via a stylesheet and allows the use of any unit for setting the width, such as the new default of `14em`. Fixes #11198 Closes gh-1467 --- diff --git a/demos/selectmenu/custom_render.html b/demos/selectmenu/custom_render.html index 9329b81b1..ec0b4b6d5 100644 --- a/demos/selectmenu/custom_render.html +++ b/demos/selectmenu/custom_render.html @@ -59,9 +59,6 @@ label { display: block; } - select { - width: 200px; - } /* select with custom icons */ .ui-selectmenu-menu .ui-menu.customicons .ui-menu-item-wrapper { diff --git a/demos/selectmenu/default.html b/demos/selectmenu/default.html index d9b198683..a845b1dba 100644 --- a/demos/selectmenu/default.html +++ b/demos/selectmenu/default.html @@ -32,9 +32,6 @@ display: block; margin: 30px 0 0 0; } - select { - width: 200px; - } .overflow { height: 200px; } diff --git a/demos/selectmenu/product-selection.html b/demos/selectmenu/product-selection.html index 40b3a921d..e759ea36a 100644 --- a/demos/selectmenu/product-selection.html +++ b/demos/selectmenu/product-selection.html @@ -41,9 +41,6 @@ display: block; margin: 20px 0 0 0; } - select { - width: 200px; - } #circle { float: left; diff --git a/tests/unit/selectmenu/selectmenu_common.js b/tests/unit/selectmenu/selectmenu_common.js index 10073fe97..bc245f962 100644 --- a/tests/unit/selectmenu/selectmenu_common.js +++ b/tests/unit/selectmenu/selectmenu_common.js @@ -10,7 +10,7 @@ TestHelpers.commonWidgetTests( "selectmenu", { at: "left bottom", collision: "none" }, - width: null, + width: false, // callbacks change: null, diff --git a/tests/unit/selectmenu/selectmenu_options.js b/tests/unit/selectmenu/selectmenu_options.js index 954d572b5..08555a1af 100644 --- a/tests/unit/selectmenu/selectmenu_options.js +++ b/tests/unit/selectmenu/selectmenu_options.js @@ -85,7 +85,7 @@ test( "CSS styles", function() { }); test( "width", function() { - expect( 5 ); + expect( 6 ); var button, element = $( "#speed" ); @@ -93,6 +93,9 @@ test( "width", function() { element.selectmenu(); button = element.selectmenu( "widget" ); + equal( button[ 0 ].style.width, "", "no inline style" ); + + element.selectmenu( "option", "width", null ); equal( button.outerWidth(), element.outerWidth(), "button width auto" ); element.outerWidth( 100 ); @@ -107,7 +110,7 @@ test( "width", function() { element .append( $( "