aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/selectmenu
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2014-04-22 18:24:04 -0400
committerScott González <scott.gonzalez@gmail.com>2014-04-22 18:24:04 -0400
commit69a3d94a064d60760f3872b959aa305fdc2e30c2 (patch)
treed09dc19fb381cefe79ab6955db8f6cafc70ea5a7 /tests/unit/selectmenu
parentbdb0f7a4cbba5bf8920f92eb91ebcc1790223dc2 (diff)
downloadjquery-ui-69a3d94a064d60760f3872b959aa305fdc2e30c2.tar.gz
jquery-ui-69a3d94a064d60760f3872b959aa305fdc2e30c2.zip
Selectmenu: Test cleanup
Diffstat (limited to 'tests/unit/selectmenu')
-rw-r--r--tests/unit/selectmenu/selectmenu_options.js52
1 files changed, 33 insertions, 19 deletions
diff --git a/tests/unit/selectmenu/selectmenu_options.js b/tests/unit/selectmenu/selectmenu_options.js
index a870b9857..32c875403 100644
--- a/tests/unit/selectmenu/selectmenu_options.js
+++ b/tests/unit/selectmenu/selectmenu_options.js
@@ -4,47 +4,54 @@ module( "selectmenu: options" );
test( "appendTo: null", function() {
expect( 1 );
+
var element = $( "#speed" ).selectmenu();
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],document.body,
+ equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], document.body,
"defaults to body" );
- element.selectmenu( "destroy" );
});
test( "appendTo: explicit", function() {
expect( 6 );
+
var detached = $( "<div>" ),
element = $( "#speed" );
element.selectmenu({
appendTo: ".selectmenu-wrap"
});
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap1" )[ 0 ], "first found element" );
+ equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
+ $( "#selectmenu-wrap1" )[ 0 ], "first found element" );
equal( $( "#selectmenu-wrap2 .ui-selectmenu" ).length, 0, "only appends to one element" );
element.selectmenu( "destroy" );
element.selectmenu().selectmenu( "option", "appendTo", "#selectmenu-wrap1" );
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap1" )[ 0 ], "modified after init" );
+ equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
+ $( "#selectmenu-wrap1" )[ 0 ], "modified after init" );
element.selectmenu( "destroy" );
element.selectmenu({
appendTo: detached
});
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ], "detached jQuery object" );
+ equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
+ "detached jQuery object" );
element.selectmenu( "destroy" );
element.selectmenu({
appendTo: detached[ 0 ]
});
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ], "detached DOM element" );
+ equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
+ "detached DOM element" );
element.selectmenu( "destroy" );
element.selectmenu().selectmenu( "option", "appendTo", detached );
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ], "detached DOM element via option()" );
+ equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
+ "detached DOM element via option()" );
element.selectmenu( "destroy" );
});
test( "appendTo: ui-front", function() {
expect( 2 );
+
var element = $( "#speed" );
$( "#selectmenu-wrap2" ).addClass( "ui-front" );
@@ -61,7 +68,7 @@ test( "appendTo: ui-front", function() {
});
-test( "CSS styles", function () {
+test( "CSS styles", function() {
expect( 2 );
var element = $( "#speed" ).selectmenu(),
@@ -69,16 +76,21 @@ test( "CSS styles", function () {
menu = element.selectmenu( "menuWidget" );
element.selectmenu( "open" );
- ok( button.hasClass( "ui-corner-top" ) && !button.hasClass( "ui-corner-all" ) && button.find( "span.ui-icon" ).hasClass( "ui-icon-triangle-1-s" ), "button styles dropdown" );
- ok( menu.hasClass( "ui-corner-bottom" ) && !menu.hasClass( "ui-corner-all" ), "menu styles dropdown" );
+ ok(
+ button.hasClass( "ui-corner-top" ) && !button.hasClass( "ui-corner-all" ) &&
+ button.find( "span.ui-icon" ).hasClass( "ui-icon-triangle-1-s" ),
+ "button styles dropdown"
+ );
+ ok( menu.hasClass( "ui-corner-bottom" ) && !menu.hasClass( "ui-corner-all" ),
+ "menu styles dropdown" );
});
-test( "Width", function () {
+test( "Width", function() {
expect( 8 );
- var element = $( "#speed" ),
- button, menu;
+ var button, menu,
+ element = $( "#speed" );
element.selectmenu();
button = element.selectmenu( "widget" );
@@ -95,17 +107,19 @@ test( "Width", function () {
element.selectmenu( "open" );
equal( menu.outerWidth(), 100, "menu width set by CSS" );
- element.width( "" );
- element.selectmenu( "option", "width", 100 );
- element.selectmenu( "refresh" );
+ element
+ .width( "" )
+ .selectmenu( "option", "width", 100 )
+ .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( $( "<option>", { text: "Option with a little longer text" } ) );
- element.selectmenu( "option", "width", "" );
- element.selectmenu( "refresh" );
+ element
+ .append( $( "<option>", { text: "Option with a little longer text" } ) )
+ .selectmenu( "option", "width", "" )
+ .selectmenu( "refresh" );
equal( button.outerWidth(), element.outerWidth(), "button width with long option" );
element.selectmenu( "open" );