diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-03-04 14:27:10 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-03-05 11:42:49 -0500 |
commit | af4c35df9d1cf4c15d57b3789711026360785831 (patch) | |
tree | 150083ab0fedf1494c5cbc409995d3513eb01578 /tests/unit/selectmenu | |
parent | 47a32fb5b3c190123937e0178900ef754c3e220d (diff) | |
download | jquery-ui-af4c35df9d1cf4c15d57b3789711026360785831.tar.gz jquery-ui-af4c35df9d1cf4c15d57b3789711026360785831.zip |
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
Diffstat (limited to 'tests/unit/selectmenu')
-rw-r--r-- | tests/unit/selectmenu/selectmenu_common.js | 2 | ||||
-rw-r--r-- | tests/unit/selectmenu/selectmenu_options.js | 9 |
2 files changed, 7 insertions, 4 deletions
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( $( "<option>", { text: "Option with a little longer text" } ) ) - .selectmenu( "option", "width", "" ) + .selectmenu( "option", "width", null ) .selectmenu( "refresh" ); equal( button.outerWidth(), element.outerWidth(), "button width with long option" ); @@ -115,7 +118,7 @@ test( "width", function() { element .selectmenu( "destroy" ) .css( "width", "100%" ) - .selectmenu(); + .selectmenu({ width: null }); button = element.selectmenu( "widget" ); equal( button.outerWidth(), 300, "button width fills container" ); }); |