From 1656cd2f340ac94b3b0c337f81eb3b31a4bb4d71 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Thu, 5 Dec 2013 22:12:05 +0100 Subject: [PATCH] Selectmenu Tests: add unit and visual tests for width option --- tests/unit/selectmenu/selectmenu_options.js | 39 +++++++++++++++ tests/visual/selectmenu/selectmenu.html | 54 ++++++++++++++++++++- 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/tests/unit/selectmenu/selectmenu_options.js b/tests/unit/selectmenu/selectmenu_options.js index 82ea6a8b4..1ab098a75 100644 --- a/tests/unit/selectmenu/selectmenu_options.js +++ b/tests/unit/selectmenu/selectmenu_options.js @@ -57,4 +57,43 @@ test( "CSS styles", function () { ok( menu.hasClass( "ui-corner-bottom" ) && !menu.hasClass( "ui-corner-all" ), "menu styles dropdown" ); }); + +test( "Width", function () { + expect( 8 ); + + var element = $( "#speed" ), + button, menu; + + element.selectmenu(); + button = element.selectmenu( "widget" ); + menu = element.selectmenu( "menuWidget" ); + + equal( button.outerWidth(), element.outerWidth(), "button width auto" ); + element.selectmenu( "open" ); + equal( menu.outerWidth(), element.outerWidth(), "menu width auto" ); + + element.outerWidth( 100 ); + element.selectmenu( "refresh" ); + + equal( button.outerWidth(), 100, "button width set by CSS" ); + element.selectmenu( "open" ); + equal( menu.outerWidth(), 100, "menu width set by CSS" ); + + element.width( "" ); + element.selectmenu( "option", "width", 100 ); + element.selectmenu( "refresh" ); + + equal( button.outerWidth(), 100, "button width set by JS option" ); + element.selectmenu( "open" ); + equal( menu.outerWidth(), 100, "menu width set by JS option" ); + + element.append( $( "