Selectmenu: Style updates

Ref #14246
This commit is contained in:
Alexander Schmitz 2015-08-24 08:50:24 -04:00
parent 9b82001a70
commit cfd48ed037
5 changed files with 88 additions and 88 deletions

View File

@ -29,6 +29,6 @@ common.testWidget( "selectmenu", {
open: null, open: null,
select: null select: null
} }
}); } );
} ); } );

View File

@ -18,15 +18,15 @@ test( "markup structure", function( assert ) {
assert.lacksClasses( button, "ui-selectmenu-button-open" ); assert.lacksClasses( button, "ui-selectmenu-button-open" );
assert.hasClasses( menuWrap, "ui-selectmenu-menu" ); assert.hasClasses( menuWrap, "ui-selectmenu-menu" );
assert.lacksClasses( menuWrap, "ui-selectmenu-menu-open" ); assert.lacksClasses( menuWrap, "ui-selectmenu-menu-open" );
}); } );
asyncTest( "accessibility", function() { asyncTest( "accessibility", function() {
var wrappers, button, menu, var wrappers, button, menu,
element = $( "#speed" ).attr( "title", "A demo title" ); element = $( "#speed" ).attr( "title", "A demo title" );
element.find( "option" ).each(function( index ) { element.find( "option" ).each( function( index ) {
$( this ).attr( "title", "A demo title #" + index ); $( this ).attr( "title", "A demo title #" + index );
}); } );
element.selectmenu(); element.selectmenu();
button = element.selectmenu( "widget" ); button = element.selectmenu( "widget" );
@ -37,7 +37,7 @@ asyncTest( "accessibility", function() {
expect( 13 + wrappers.length * 3 ); expect( 13 + wrappers.length * 3 );
setTimeout(function() { setTimeout( function() {
equal( button.attr( "role" ), "combobox", "button role" ); equal( button.attr( "role" ), "combobox", "button role" );
equal( button.attr( "aria-haspopup" ), "true", "button aria-haspopup" ); equal( button.attr( "aria-haspopup" ), "true", "button aria-haspopup" );
equal( button.attr( "aria-expanded" ), "false", "button aria-expanded" ); equal( button.attr( "aria-expanded" ), "false", "button aria-expanded" );
@ -62,13 +62,13 @@ asyncTest( "accessibility", function() {
); );
$.each( wrappers, function( index ) { $.each( wrappers, function( index ) {
var item = $( this ); var item = $( this );
equal( item.attr( "role" ), "option", "menu item #" + index +" role" ); equal( item.attr( "role" ), "option", "menu item #" + index + " role" );
equal( item.attr( "tabindex" ), -1, "menu item #" + index +" tabindex" ); equal( item.attr( "tabindex" ), -1, "menu item #" + index + " tabindex" );
equal( item.attr( "title" ), "A demo title #" + index, "menu item #" + index + " title" ); equal( item.attr( "title" ), "A demo title #" + index, "menu item #" + index + " title" );
}); } );
start(); start();
}); } );
}); } );
test( "_renderButtonItem()", function() { test( "_renderButtonItem()", function() {
expect( 2 ); expect( 2 );
@ -102,9 +102,9 @@ test( "_renderButtonItem()", function() {
button.text(), button.text(),
"click: button item text" "click: button item text"
); );
}); } );
$.each([ $.each( [
{ {
type: "default", type: "default",
selector: "#speed" selector: "#speed"
@ -127,7 +127,7 @@ $.each([
selected = element.find( "option:selected" ).next(); selected = element.find( "option:selected" ).next();
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" );
button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
@ -143,13 +143,13 @@ $.each([
); );
equal( equal(
element.find( "option:selected" ).val(), element.find( "option:selected" ).val(),
selected.val() , selected.val(),
"original select state" "original select state"
); );
equal( button.text(), selected.text(), "button text" ); equal( button.text(), selected.text(), "button text" );
start(); start();
}); } );
}); } );
asyncTest( "state synchronization - after click on item - " + settings.type, function() { asyncTest( "state synchronization - after click on item - " + settings.type, function() {
expect( 4 ); expect( 4 );
@ -161,7 +161,7 @@ $.each([
selected = element.find( "option" ).last(); selected = element.find( "option" ).last();
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" );
button.trigger( "click" ); button.trigger( "click" );
@ -184,7 +184,7 @@ $.each([
equal( button.text(), selected.text(), "button text" ); equal( button.text(), selected.text(), "button text" );
start(); start();
}, 1 ); }, 1 );
}); } );
asyncTest( "state synchronization - " + asyncTest( "state synchronization - " +
"after focus item and keydown on button - " + settings.type, function() { "after focus item and keydown on button - " + settings.type, function() {
@ -199,7 +199,7 @@ $.each([
// Init menu // Init menu
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" );
// Open menu and click first item // Open menu and click first item
@ -213,20 +213,20 @@ $.each([
// Close and use keyboard control on button // Close and use keyboard control on button
button.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); button.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( menu.attr( "aria-activedescendant" ), wrappers.eq( 1 ).attr( "id" ), equal( menu.attr( "aria-activedescendant" ), wrappers.eq( 1 ).attr( "id" ),
"menu aria-activedescendant" ); "menu aria-activedescendant" );
equal( button.attr( "aria-activedescendant" ), wrappers.eq( 1 ).attr( "id" ), equal( button.attr( "aria-activedescendant" ), wrappers.eq( 1 ).attr( "id" ),
"button aria-activedescendant" ); "button aria-activedescendant" );
equal( element.find( "option:selected" ).val(), options.eq( 1 ).val() , equal( element.find( "option:selected" ).val(), options.eq( 1 ).val(),
"original select state" ); "original select state" );
equal( button.text(), options.eq( 1 ).text(), "button text" ); equal( button.text(), options.eq( 1 ).text(), "button text" );
start(); start();
}); } );
}); } );
}); } );
asyncTest( "item looping - " + settings.type, function() { asyncTest( "item looping - " + settings.type, function() {
expect( 4 ); expect( 4 );
@ -237,7 +237,7 @@ $.each([
menu = element.selectmenu( "menuWidget" ); menu = element.selectmenu( "menuWidget" );
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" );
button.trigger( "click" ); button.trigger( "click" );
@ -252,8 +252,8 @@ $.each([
button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( element[ 0 ].selectedIndex, wrappers.length - 1, "No looping behind last item" ); equal( element[ 0 ].selectedIndex, wrappers.length - 1, "No looping behind last item" );
start(); start();
}); } );
}); } );
asyncTest( "item focus and active state - " + settings.type, function() { asyncTest( "item focus and active state - " + settings.type, function() {
expect( 4 ); expect( 4 );
@ -264,11 +264,11 @@ $.each([
menu = element.selectmenu( "menuWidget" ); menu = element.selectmenu( "menuWidget" );
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" );
button.trigger( "click" ); button.trigger( "click" );
setTimeout(function() { setTimeout( function() {
checkItemClasses(); checkItemClasses();
wrappers.eq( 3 ).simulate( "mouseover" ).trigger( "click" ); wrappers.eq( 3 ).simulate( "mouseover" ).trigger( "click" );
@ -282,12 +282,12 @@ $.each([
$( document ).trigger( "click" ); $( document ).trigger( "click" );
button.trigger( "click" ); button.trigger( "click" );
setTimeout(function() { setTimeout( function() {
checkItemClasses(); checkItemClasses();
start(); start();
}); } );
}); } );
}); } );
function checkItemClasses() { function checkItemClasses() {
focusedItem = menu.find( ".ui-menu-item-wrapper.ui-state-active" ); focusedItem = menu.find( ".ui-menu-item-wrapper.ui-state-active" );
@ -295,7 +295,7 @@ $.each([
equal( focusedItem.attr( "id" ), wrappers.eq( element[ 0 ].selectedIndex ).attr( "id" ), equal( focusedItem.attr( "id" ), wrappers.eq( element[ 0 ].selectedIndex ).attr( "id" ),
"selected item has ui-state-focus class" ); "selected item has ui-state-focus class" );
} }
}); } );
asyncTest( "empty option - " + settings.type, function( assert ) { asyncTest( "empty option - " + settings.type, function( assert ) {
expect( 7 ); expect( 7 );
@ -309,7 +309,7 @@ $.each([
menu = element.selectmenu( "menuWidget" ); menu = element.selectmenu( "menuWidget" );
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
wrappers = menu.find( "li:not(.ui-selectmenu-optgroup) .ui-menu-item-wrapper" ); wrappers = menu.find( "li:not(.ui-selectmenu-optgroup) .ui-menu-item-wrapper" );
wrapper = wrappers.first(); wrapper = wrappers.first();
@ -325,8 +325,8 @@ $.each([
equal( wrapper.attr( "role" ), "option", "empty item has role option" ); equal( wrapper.attr( "role" ), "option", "empty item has role option" );
start(); start();
}); } );
}); } );
}); } );
} ); } );

View File

@ -7,7 +7,7 @@ module( "selectmenu: events", {
setup: function() { setup: function() {
this.element = $( "#speed" ); this.element = $( "#speed" );
} }
}); } );
asyncTest( "change", function() { asyncTest( "change", function() {
expect( 3 ); expect( 3 );
@ -15,15 +15,15 @@ asyncTest( "change", function() {
var button, menu, options, var button, menu, options,
optionIndex = 1; optionIndex = 1;
this.element.selectmenu({ this.element.selectmenu( {
change: function ( event, ui ) { change: function( event, ui ) {
equal( ui.item.index, optionIndex, "ui.item.index contains correct option index" ); equal( ui.item.index, optionIndex, "ui.item.index contains correct option index" );
equal( ui.item.element[ 0 ], options.eq( optionIndex )[ 0 ], equal( ui.item.element[ 0 ], options.eq( optionIndex )[ 0 ],
"ui.item.element contains original option element" ); "ui.item.element contains original option element" );
equal( ui.item.value, options.eq( optionIndex ).text(), equal( ui.item.value, options.eq( optionIndex ).text(),
"ui.item.value property updated correctly" ); "ui.item.value property updated correctly" );
} }
}); } );
button = this.element.selectmenu( "widget" ); button = this.element.selectmenu( "widget" );
menu = this.element.selectmenu( "menuWidget" ); menu = this.element.selectmenu( "menuWidget" );
@ -31,23 +31,23 @@ asyncTest( "change", function() {
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
button.trigger( "click" ); button.trigger( "click" );
menu.find( "li" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" ); menu.find( "li" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" );
start(); start();
}); } );
}); } );
test( "close", function() { test( "close", function() {
expect( 2 ); expect( 2 );
var shouldFire; var shouldFire;
this.element.selectmenu({ this.element.selectmenu( {
close: function() { close: function() {
ok( shouldFire, "close event fired on close" ); ok( shouldFire, "close event fired on close" );
} }
}); } );
shouldFire = false; shouldFire = false;
this.element.selectmenu( "open" ); this.element.selectmenu( "open" );
@ -57,7 +57,7 @@ test( "close", function() {
this.element.selectmenu( "open" ); this.element.selectmenu( "open" );
shouldFire = true; shouldFire = true;
$( "body" ).trigger( "mousedown" ); $( "body" ).trigger( "mousedown" );
}); } );
asyncTest( "focus", function() { asyncTest( "focus", function() {
expect( 9 ); expect( 9 );
@ -67,20 +67,20 @@ asyncTest( "focus", function() {
optionIndex = this.element[ 0 ].selectedIndex + 1, optionIndex = this.element[ 0 ].selectedIndex + 1,
options = this.element.find( "option" ); options = this.element.find( "option" );
this.element.selectmenu({ this.element.selectmenu( {
focus: function( event, ui ) { focus: function( event, ui ) {
ok( true, "focus event fired on element #" + optionIndex + " mouseover" ); ok( true, "focus event fired on element #" + optionIndex + " mouseover" );
equal( ui.item.index, optionIndex, "ui.item.index contains correct option index" ); equal( ui.item.index, optionIndex, "ui.item.index contains correct option index" );
equal( ui.item.element[ 0 ], options.eq( optionIndex )[ 0 ], equal( ui.item.element[ 0 ], options.eq( optionIndex )[ 0 ],
"ui.item.element contains original option element" ); "ui.item.element contains original option element" );
} }
}); } );
button = this.element.selectmenu( "widget" ); button = this.element.selectmenu( "widget" );
menu = this.element.selectmenu( "menuWidget" ); menu = this.element.selectmenu( "menuWidget" );
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
button.trigger( "click" ); button.trigger( "click" );
@ -93,32 +93,32 @@ asyncTest( "focus", function() {
// This tests for unwanted, additional focus event on close // This tests for unwanted, additional focus event on close
that.element.selectmenu( "close" ); that.element.selectmenu( "close" );
start(); start();
}); } );
}); } );
test( "open", function() { test( "open", function() {
expect( 1 ); expect( 1 );
this.element.selectmenu({ this.element.selectmenu( {
open: function() { open: function() {
ok( true, "open event fired on open" ); ok( true, "open event fired on open" );
} }
}); } );
this.element.selectmenu( "open" ); this.element.selectmenu( "open" );
}); } );
asyncTest( "select", function() { asyncTest( "select", function() {
expect( 3 ); expect( 3 );
this.element.selectmenu({ this.element.selectmenu( {
select: function( event, ui ) { select: function( event, ui ) {
ok( true, "select event fired on item select" ); ok( true, "select event fired on item select" );
equal( ui.item.index, optionIndex, "ui.item.index contains correct option index" ); equal( ui.item.index, optionIndex, "ui.item.index contains correct option index" );
equal( ui.item.element[ 0 ], options.eq( optionIndex )[ 0 ], equal( ui.item.element[ 0 ], options.eq( optionIndex )[ 0 ],
"ui.item.element contains original option element" ); "ui.item.element contains original option element" );
} }
}); } );
var button = this.element.selectmenu( "widget" ), var button = this.element.selectmenu( "widget" ),
menu = this.element.selectmenu( "menuWidget" ), menu = this.element.selectmenu( "menuWidget" ),
@ -126,11 +126,11 @@ asyncTest( "select", function() {
optionIndex = 1; optionIndex = 1;
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
button.trigger( "click" ); button.trigger( "click" );
menu.find( "li" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" ); menu.find( "li" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" );
start(); start();
}); } );
}); } );
} ); } );

View File

@ -9,8 +9,8 @@ test( "destroy", function( assert ) {
expect( 1 ); expect( 1 );
assert.domEqual( "#speed", function() { assert.domEqual( "#speed", function() {
$( "#speed" ).selectmenu().selectmenu( "destroy" ); $( "#speed" ).selectmenu().selectmenu( "destroy" );
}); } );
}); } );
test( "open / close", function() { test( "open / close", function() {
expect( 5 ); expect( 5 );
@ -27,7 +27,7 @@ test( "open / close", function() {
element.selectmenu( "close" ); element.selectmenu( "close" );
ok( menu.is( ":hidden" ), "close: menu hidden" ); ok( menu.is( ":hidden" ), "close: menu hidden" );
equal( menu.attr( "aria-hidden" ), "true", "close: menu aria-disabled" ); equal( menu.attr( "aria-hidden" ), "true", "close: menu aria-disabled" );
}); } );
test( "enable / disable", function() { test( "enable / disable", function() {
expect( 10 ); expect( 10 );
@ -49,7 +49,7 @@ test( "enable / disable", function() {
equal( button.attr( "aria-disabled" ), "false", "enable: button ARIA" ); equal( button.attr( "aria-disabled" ), "false", "enable: button ARIA" );
equal( button.attr( "tabindex" ), 0, "enable: button tabindex" ); equal( button.attr( "tabindex" ), 0, "enable: button tabindex" );
equal( menu.attr( "aria-disabled" ), "false", "enable: menu ARIA" ); equal( menu.attr( "aria-disabled" ), "false", "enable: menu ARIA" );
}); } );
test( "refresh - structure", function() { test( "refresh - structure", function() {
expect( 3 ); expect( 3 );
@ -73,7 +73,7 @@ test( "refresh - structure", function() {
equal( options.length, menuItems.length, "menu item length" ); equal( options.length, menuItems.length, "menu item length" );
equal( "Added option", menuItems.last().text(), "added item" ); equal( "Added option", menuItems.last().text(), "added item" );
equal( "Changed value", menuItems.eq( 0 ).text(), "changed item" ); equal( "Changed value", menuItems.eq( 0 ).text(), "changed item" );
}); } );
asyncTest( "refresh - change selected option", function() { asyncTest( "refresh - change selected option", function() {
expect( 4 ); expect( 4 );
@ -84,7 +84,7 @@ asyncTest( "refresh - change selected option", function() {
equal( element.find( "option:selected" ).text(), button.text(), "button text after init" ); equal( element.find( "option:selected" ).text(), button.text(), "button text after init" );
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout( function() {
equal( element.find( "option:selected" ).text(), button.text(), "button text after focus" ); equal( element.find( "option:selected" ).text(), button.text(), "button text after focus" );
element[ 0 ].selectedIndex = 0; element[ 0 ].selectedIndex = 0;
@ -98,8 +98,8 @@ asyncTest( "refresh - change selected option", function() {
equal( "Selected option", button.text(), "button text after adding selected option" ); equal( "Selected option", button.text(), "button text after adding selected option" );
start(); start();
}); } );
}); } );
test( "refresh - disabled select", function() { test( "refresh - disabled select", function() {
expect( 4 ); expect( 4 );
@ -115,7 +115,7 @@ test( "refresh - disabled select", function() {
equal( button.attr( "aria-disabled" ), "true", "button ARIA" ); equal( button.attr( "aria-disabled" ), "true", "button ARIA" );
equal( button.attr( "tabindex" ), -1, "button tabindex" ); equal( button.attr( "tabindex" ), -1, "button tabindex" );
equal( menu.attr( "aria-disabled" ), "true", "menu ARIA" ); equal( menu.attr( "aria-disabled" ), "true", "menu ARIA" );
}); } );
test( "refresh - disabled option", function( assert ) { test( "refresh - disabled option", function( assert ) {
expect( 1 ); expect( 1 );
@ -129,7 +129,7 @@ test( "refresh - disabled option", function( assert ) {
disabledItem = menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).eq( 2 ); disabledItem = menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).eq( 2 );
assert.hasClasses( disabledItem, "ui-state-disabled" ); assert.hasClasses( disabledItem, "ui-state-disabled" );
}); } );
test( "refresh - disabled optgroup", function( assert ) { test( "refresh - disabled optgroup", function( assert ) {
var i, item, var i, item,
@ -156,7 +156,7 @@ test( "refresh - disabled optgroup", function( assert ) {
item = item.next( "li" ); item = item.next( "li" );
assert.hasClasses( item, "ui-state-disabled" ); assert.hasClasses( item, "ui-state-disabled" );
} }
}); } );
test( "refresh - remove all options", function() { test( "refresh - remove all options", function() {
expect( 2 ); expect( 2 );
@ -170,7 +170,7 @@ test( "refresh - remove all options", function() {
equal( button.find( ".ui-selectmenu-text" ).html(), $( "<span>&#160;</span>" ).html(), equal( button.find( ".ui-selectmenu-text" ).html(), $( "<span>&#160;</span>" ).html(),
"Empty button text" ); "Empty button text" );
equal( menu.children().length, 0, "Empty menu" ); equal( menu.children().length, 0, "Empty menu" );
}); } );
test( "widget and menuWidget", function( assert ) { test( "widget and menuWidget", function( assert ) {
expect( 4 ); expect( 4 );
@ -184,6 +184,6 @@ test( "widget and menuWidget", function( assert ) {
equal( menu.length, 1, "Menu Widget: one element" ); equal( menu.length, 1, "Menu Widget: one element" );
ok( menu.is( "ul.ui-menu" ), "Menu Widget: element and class" ); ok( menu.is( "ul.ui-menu" ), "Menu Widget: element and class" );
}); } );
} ); } );

View File

@ -11,7 +11,7 @@ test( "appendTo: null", function() {
var element = $( "#speed" ).selectmenu(); 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" ); "defaults to body" );
}); } );
test( "appendTo: explicit", function() { test( "appendTo: explicit", function() {
expect( 6 ); expect( 6 );
@ -19,9 +19,9 @@ test( "appendTo: explicit", function() {
var detached = $( "<div>" ), var detached = $( "<div>" ),
element = $( "#speed" ); element = $( "#speed" );
element.selectmenu({ element.selectmenu( {
appendTo: ".selectmenu-wrap" appendTo: ".selectmenu-wrap"
}); } );
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
$( "#selectmenu-wrap1" )[ 0 ], "first found element" ); $( "#selectmenu-wrap1" )[ 0 ], "first found element" );
equal( $( "#selectmenu-wrap2 .ui-selectmenu" ).length, 0, "only appends to one element" ); equal( $( "#selectmenu-wrap2 .ui-selectmenu" ).length, 0, "only appends to one element" );
@ -32,16 +32,16 @@ test( "appendTo: explicit", function() {
$( "#selectmenu-wrap1" )[ 0 ], "modified after init" ); $( "#selectmenu-wrap1" )[ 0 ], "modified after init" );
element.selectmenu( "destroy" ); element.selectmenu( "destroy" );
element.selectmenu({ element.selectmenu( {
appendTo: detached appendTo: detached
}); } );
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ], equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
"detached jQuery object" ); "detached jQuery object" );
element.selectmenu( "destroy" ); element.selectmenu( "destroy" );
element.selectmenu({ element.selectmenu( {
appendTo: detached[ 0 ] appendTo: detached[ 0 ]
}); } );
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ], equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
"detached DOM element" ); "detached DOM element" );
element.selectmenu( "destroy" ); element.selectmenu( "destroy" );
@ -50,7 +50,7 @@ test( "appendTo: explicit", function() {
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ], equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
"detached DOM element via option()" ); "detached DOM element via option()" );
element.selectmenu( "destroy" ); element.selectmenu( "destroy" );
}); } );
test( "appendTo: ui-front", function() { test( "appendTo: ui-front", function() {
expect( 2 ); expect( 2 );
@ -63,12 +63,12 @@ test( "appendTo: ui-front", function() {
$( "#selectmenu-wrap2" )[ 0 ], "null, inside .ui-front" ); $( "#selectmenu-wrap2" )[ 0 ], "null, inside .ui-front" );
element.selectmenu( "destroy" ); element.selectmenu( "destroy" );
element.selectmenu({ element.selectmenu( {
appendTo: $() appendTo: $()
}); } );
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
$( "#selectmenu-wrap2" )[ 0 ], "empty jQuery object, inside .ui-front" ); $( "#selectmenu-wrap2" )[ 0 ], "empty jQuery object, inside .ui-front" );
}); } );
test( "CSS styles", function( assert ) { test( "CSS styles", function( assert ) {
expect( 5 ); expect( 5 );
@ -84,7 +84,7 @@ test( "CSS styles", function( assert ) {
assert.hasClasses( button.find( "span.ui-icon" ), "ui-icon-triangle-1-s" ); assert.hasClasses( button.find( "span.ui-icon" ), "ui-icon-triangle-1-s" );
assert.hasClasses( menu, "ui-corner-bottom" ); assert.hasClasses( menu, "ui-corner-bottom" );
assert.lacksClasses( button, "ui-corner-all" ); assert.lacksClasses( button, "ui-corner-all" );
}); } );
test( "width", function() { test( "width", function() {
expect( 6 ); expect( 6 );
@ -120,9 +120,9 @@ test( "width", function() {
element element
.selectmenu( "destroy" ) .selectmenu( "destroy" )
.css( "width", "100%" ) .css( "width", "100%" )
.selectmenu({ width: null }); .selectmenu( { width: null } );
button = element.selectmenu( "widget" ); button = element.selectmenu( "widget" );
equal( button.outerWidth(), 300, "button width fills container" ); equal( button.outerWidth(), 300, "button width fills container" );
}); } );
} ); } );