diff --git a/tests/unit/selectmenu/selectmenu_core.js b/tests/unit/selectmenu/selectmenu_core.js index 79aaddade..97012fb6e 100644 --- a/tests/unit/selectmenu/selectmenu_core.js +++ b/tests/unit/selectmenu/selectmenu_core.js @@ -4,33 +4,33 @@ module( "selectmenu: core" ); test("accessibility", function () { var links, - element = $("#speed").selectmenu(), - button = element.selectmenu("widget"), - menu = element.selectmenu("menuWidget"); + element = $( "#speed" ).selectmenu(), + button = element.selectmenu( "widget" ), + menu = element.selectmenu( "menuWidget" ); button.simulate( "focus" ); - links = menu.find("li.ui-menu-item a"); + links = menu.find( "li.ui-menu-item a" ); expect(13 + links.length * 2); - equal( button.attr("role"), "combobox", "button link role" ); - equal( button.attr("aria-haspopup"), "true", "button link aria-haspopup" ); - equal( button.attr("aria-expanded"), "false", "button link aria-expanded" ); - equal( button.attr("aria-autocomplete"), "list", "button link aria-autocomplete" ); - equal( button.attr("aria-owns"), menu.attr("id"), "button link aria-owns" ); - equal( button.attr("aria-labelledby"), links.eq( element[0].selectedIndex ).attr( "id" ), "button link aria-labelledby" ); - equal( button.attr("tabindex"), 0, "button link tabindex" ); + equal( button.attr( "role" ), "combobox", "button link role" ); + equal( button.attr( "aria-haspopup" ), "true", "button link aria-haspopup" ); + equal( button.attr( "aria-expanded" ), "false", "button link aria-expanded" ); + equal( button.attr( "aria-autocomplete" ), "list", "button link aria-autocomplete" ); + equal( button.attr( "aria-owns" ), menu.attr("id"), "button link aria-owns" ); + equal( button.attr( "aria-labelledby" ), links.eq( element[0].selectedIndex ).attr( "id" ), "button link aria-labelledby" ); + equal( button.attr( "tabindex" ), 0, "button link tabindex" ); - equal( menu.attr("role"), "listbox", "menu role" ); - equal( menu.attr("aria-labelledby"), button.attr("id"), "menu aria-labelledby" ); - equal( menu.attr("aria-hidden"), "true", "menu aria-hidden" ); - equal( menu.attr("tabindex"), 0, "menu tabindex" ); - equal( menu.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "menu aria-activedescendant" ); - $.each( links, function(index){ - equal( $(this).attr("role"), "option", "menu link #" + index +" role" ); - equal( $(this).attr("tabindex"), -1, "menu link #" + index +" tabindex" ); + equal( menu.attr( "role" ), "listbox", "menu role" ); + equal( menu.attr( "aria-labelledby" ), button.attr( "id" ), "menu aria-labelledby" ); + equal( menu.attr( "aria-hidden" ), "true", "menu aria-hidden" ); + equal( menu.attr( "tabindex" ), 0, "menu tabindex" ); + equal( menu.attr( "aria-activedescendant" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "menu aria-activedescendant" ); + $.each( links, function( index ){ + equal( $( this ).attr( "role" ), "option", "menu link #" + index +" role" ); + equal( $( this ).attr( "tabindex" ), -1, "menu link #" + index +" tabindex" ); }); - equal( links.eq(element[0].selectedIndex).attr("aria-selected"), "true", "selected menu link aria-selected" ); + equal( links.eq( element[ 0 ].selectedIndex ).attr( "aria-selected" ), "true", "selected menu link aria-selected" ); }); @@ -44,75 +44,75 @@ $.each([ selector: "#files" } ], function( i, settings ) { - test("state synchronization - after keydown on button - " + settings.type, function () { - expect(5); + test( "state synchronization - after keydown on button - " + settings.type, function () { + expect( 5 ); var links, - element = $(settings.selector).selectmenu(), - button = element.selectmenu("widget"), - menu = element.selectmenu("menuWidget"), - selected = element.find("option:selected"); + element = $( settings.selector ).selectmenu(), + button = element.selectmenu( "widget" ), + menu = element.selectmenu( "menuWidget" ), + selected = element.find( "option:selected" ); button.simulate( "focus" ); links = menu.find("li.ui-menu-item a"); button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equal( menu.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "menu aria-activedescendant" ); - equal( links.eq(element[0].selectedIndex).attr("aria-selected"), "true", "selected menu link aria-selected" ); - equal( button.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "button aria-activedescendant" ); - equal( element.find("option:selected").val(), selected.next("option").val() , "original select state" ); - equal( button.text(), selected.next("option").text(), "button text" ); + equal( menu.attr( "aria-activedescendant" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "menu aria-activedescendant" ); + equal( links.eq( element[ 0 ].selectedIndex ).attr( "aria-selected" ), "true", "selected menu link aria-selected" ); + equal( button.attr( "aria-activedescendant" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "button aria-activedescendant" ); + equal( element.find( "option:selected" ).val(), selected.next( "option" ).val() , "original select state" ); + equal( button.text(), selected.next( "option" ).text(), "button text" ); }); test("state synchronization - after click on item - " + settings.type, function () { expect(5); var links, - element = $(settings.selector).selectmenu(), - button = element.selectmenu("widget"), - menu = element.selectmenu("menuWidget"); + element = $( settings.selector ).selectmenu(), + button = element.selectmenu( "widget" ), + menu = element.selectmenu( "menuWidget" ); button.simulate( "focus" ); links = menu.find("li.ui-menu-item a"); button.simulate( "click" ); - menu.find("a").last().simulate( "mouseover" ).trigger( "click" ); - equal( menu.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "menu aria-activedescendant" ); - equal( links.eq(element[0].selectedIndex).attr("aria-selected"), "true", "selected menu link aria-selected" ); - equal( button.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "button aria-activedescendant" ); - equal( element.find("option:selected").val(), element.find("option").last().val(), "original select state" ); - equal( button.text(), element.find("option").last().text(), "button text" ); + menu.find( "a" ).last().simulate( "mouseover" ).trigger( "click" ); + equal( menu.attr( "aria-activedescendant" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "menu aria-activedescendant" ); + equal( links.eq( element[ 0 ].selectedIndex ).attr( "aria-selected" ), "true", "selected menu link aria-selected" ); + equal( button.attr( "aria-activedescendant" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "button aria-activedescendant" ); + equal( element.find( "option:selected" ).val(), element.find( "option" ).last().val(), "original select state" ); + equal( button.text(), element.find( "option" ).last().text(), "button text" ); }); - - test("state synchronization - after focus item and keydown on button - " + settings.type, function () { + + test( "state synchronization - after focus item and keydown on button - " + settings.type, function () { expect(5); var links, - element = $(settings.selector).selectmenu(), - button = element.selectmenu("widget"), - menu = element.selectmenu("menuWidget"), - selected = element.find("option:selected"), - options = element.find("option"); + element = $( settings.selector ).selectmenu(), + button = element.selectmenu( "widget" ), + menu = element.selectmenu( "menuWidget" ), + selected = element.find( "option:selected" ), + options = element.find( "option" ); // init menu - button.simulate( "focus" ); - links = menu.find("li.ui-menu-item a"); + button.simulate( "focus" ); + links = menu.find( "li.ui-menu-item a" ); // open menu and click first item - button.simulate( "click" ); + button.simulate( "click" ); links.first().simulate( "mouseover" ).trigger( "click" ); // open menu again and hover item - button.simulate( "click" ); + button.simulate( "click" ); links.eq(3).simulate( "mouseover" ); // close and use keyboard control on button button.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); button.simulate( "focus" ); button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - - equal( menu.attr("aria-activedescendant"), links.eq(1).attr("id"), "menu aria-activedescendant" ); - equal( links.eq(1).attr("aria-selected"), "true", "selected menu link aria-selected" ); - equal( button.attr("aria-activedescendant"), links.eq(1).attr("id"), "button aria-activedescendant" ); - equal( element.find("option:selected").val(), options.eq(1).val() , "original select state" ); - equal( button.text(), options.eq(1).text(), "button text" ); + + equal( menu.attr( "aria-activedescendant" ), links.eq( 1 ).attr( "id" ), "menu aria-activedescendant" ); + equal( links.eq( 1 ).attr("aria-selected" ), "true", "selected menu link aria-selected" ); + equal( button.attr( "aria-activedescendant" ), links.eq( 1 ).attr( "id" ), "button aria-activedescendant" ); + equal( element.find( "option:selected" ).val(), options.eq( 1 ).val() , "original select state" ); + equal( button.text(), options.eq( 1 ).text(), "button text" ); }); }); diff --git a/tests/unit/selectmenu/selectmenu_events.js b/tests/unit/selectmenu/selectmenu_events.js index 15e7cc5da..ea9f8d0fb 100644 --- a/tests/unit/selectmenu/selectmenu_events.js +++ b/tests/unit/selectmenu/selectmenu_events.js @@ -1,110 +1,110 @@ (function ($) { -module("selectmenu: events", { +module( "selectmenu: events", { setup: function () { - this.element = $("#speed"); + this.element = $( "#speed" ); } }); -test("change", function () { - expect(5); +test( "change", function () { + expect( 5 ); this.element.selectmenu({ - change: function (event, ui) { - ok(event, "change event fired on change"); - equal(event.type, "selectmenuchange", "event type set to selectmenuchange"); - ok(ui, "ui object is passed as second argument to event handler"); - equal(ui.item.element[0].nodeName, "OPTION", "ui.item.element[0] points to original option element"); - equal(ui.item.value, value, "ui.item.value property updated correctly"); + change: function ( event, ui ) { + ok( event, "change event fired on change" ); + equal( event.type, "selectmenuchange", "event type set to selectmenuchange" ); + ok(ui, "ui object is passed as second argument to event handler" ); + equal( ui.item.element[ 0 ].nodeName, "OPTION", "ui.item.element[0] points to original option element" ); + equal( ui.item.value, value, "ui.item.value property updated correctly" ); } }); - var button = this.element.selectmenu("widget").parent(), - menu = this.element.selectmenu("menuWidget").parent(), - value = this.element.find("option").first().text(); + var button = this.element.selectmenu( "widget" ).parent(), + menu = this.element.selectmenu( "menuWidget" ).parent(), + value = this.element.find( "option" ).first().text(); - button.find("a").simulate( "focus" ).simulate( "click" ); - menu.find("a").first().simulate( "mouseover" ).trigger( "click" ); + button.find( "a" ).simulate( "focus" ).simulate( "click" ); + menu.find( "a" ).first().simulate( "mouseover" ).trigger( "click" ); }); -test("close", function () { - expect(3); +test( "close", function () { + expect( 3 ); this.element.selectmenu({ - close: function (event, ui) { - ok(event, "close event fired on close"); - equal(event.type, "selectmenuclose", "event type set to selectmenuclose"); - ok(ui, "ui object is passed as second argument to event handler"); + close: function ( event, ui ) { + ok( event, "close event fired on close" ); + equal( event.type, "selectmenuclose", "event type set to selectmenuclose" ); + ok( ui, "ui object is passed as second argument to event handler" ); } }); - this.element.selectmenu("open").selectmenu("close"); + this.element.selectmenu( "open" ).selectmenu( "close" ); }); -test("focus", function () { - expect(4); +test( "focus", function () { + expect( 4 ); var button, menu, links; this.element.selectmenu({ - focus: function (event, ui) { - ok(event, "focus event fired on mouseover"); - equal(event.type, "selectmenufocus", "event type set to selectmenufocus"); - ok(ui, "ui object is passed as second argument to event handler"); - equal(ui.item.element[0].nodeName, "OPTION", "ui points to original option element"); + focus: function ( event, ui ) { + ok( event, "focus event fired on mouseover" ); + equal( event.type, "selectmenufocus", "event type set to selectmenufocus" ); + ok( ui, "ui object is passed as second argument to event handler" ); + equal( ui.item.element[0].nodeName, "OPTION", "ui points to original option element" ); } }); - - button = this.element.selectmenu("widget"), - menu = this.element.selectmenu("menuWidget"); + + button = this.element.selectmenu( "widget" ), + menu = this.element.selectmenu( "menuWidget" ); button.simulate( "focus" ); - links = menu.find("li.ui-menu-item a"); - + links = menu.find( "li.ui-menu-item a" ); + button.simulate( "click" ); - - menu.find("a").last().simulate( "mouseover" ); - - this.element.selectmenu("close"); + + menu.find( "a" ).last().simulate( "mouseover" ); + + this.element.selectmenu( "close" ); }); -test("open", function () { - expect(3); +test( "open", function () { + expect( 3 ); this.element.selectmenu({ - open: function (event, ui) { - ok(event, "open event fired on open"); - equal(event.type, "selectmenuopen", "event type set to selectmenuopen"); - ok(ui, "ui object is passed as second argument to event handler"); + open: function ( event, ui ) { + ok( event, "open event fired on open" ); + equal( event.type, "selectmenuopen", "event type set to selectmenuopen" ); + ok( ui, "ui object is passed as second argument to event handler" ); } }); - this.element.selectmenu("open"); + this.element.selectmenu( "open" ); }); -test("select", function () { - expect(4); +test( "select", function () { + expect( 4 ); this.element.selectmenu({ - select: function (event, ui) { - ok(event, "select event fired on item select"); - equal(event.type, "selectmenuselect", "event type set to selectmenuselect"); - ok(ui, "ui object is passed as second argument to event handler"); - equal(ui.item.element[0].nodeName, "OPTION", "ui points to original option element"); + select: function ( event, ui ) { + ok( event, "select event fired on item select" ); + equal( event.type, "selectmenuselect", "event type set to selectmenuselect" ); + ok( ui, "ui object is passed as second argument to event handler" ); + equal( ui.item.element[0].nodeName, "OPTION", "ui points to original option element" ); } }); - var button = this.element.selectmenu("widget").parent(), - menu = this.element.selectmenu("menuWidget").parent(); + var button = this.element.selectmenu( "widget" ).parent(), + menu = this.element.selectmenu( "menuWidget" ).parent(); - button.find("a").simulate( "focus" ).simulate( "click" ); - menu.find("a").first().simulate( "mouseover" ).trigger("click"); + button.find( "a" ).simulate( "focus" ).simulate( "click" ); + menu.find( "a" ).first().simulate( "mouseover" ).trigger( "click" ); }); })(jQuery); diff --git a/tests/unit/selectmenu/selectmenu_methods.js b/tests/unit/selectmenu/selectmenu_methods.js index 2f2caa5d0..a007cae92 100644 --- a/tests/unit/selectmenu/selectmenu_methods.js +++ b/tests/unit/selectmenu/selectmenu_methods.js @@ -13,152 +13,152 @@ test( "destroy", function() { test( "open / close", function() { expect( 4 ); - var element = $("#speed").selectmenu(), - menu = element.selectmenu("menuWidget"); + var element = $( "#speed" ).selectmenu(), + menu = element.selectmenu( "menuWidget" ); - element.selectmenu("open"); + element.selectmenu( "open" ); ok( menu.is( ":visible" ), "open: menu visible" ); - equal( menu.attr("aria-hidden"), "false", "open: menu aria-disabled" ); + equal( menu.attr( "aria-hidden" ), "false", "open: menu aria-disabled" ); - element.selectmenu("close"); + element.selectmenu( "close" ); 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); - var element = $("#speed").selectmenu(), - button = element.selectmenu("widget"), - menu = element.selectmenu("menuWidget"); + var element = $( "#speed" ).selectmenu(), + button = element.selectmenu( "widget" ), + menu = element.selectmenu( "menuWidget" ); - element.selectmenu("disable"); - ok( element.selectmenu("option", "disabled"), "disable: widget option" ); - equal( element.attr("disabled"), "disabled", "disable: native select disabled" ); - equal( button.attr("aria-disabled"), "true", "disable: button wrapper ARIA" ); - equal( button.attr("tabindex"), -1, "disable: button tabindex" ); - equal( menu.attr("aria-disabled"), "true", "disable: menu wrapper ARIA" ); + element.selectmenu( "disable" ); + ok( element.selectmenu( "option", "disabled" ), "disable: widget option" ); + equal( element.attr( "disabled" ), "disabled", "disable: native select disabled" ); + equal( button.attr( "aria-disabled" ), "true", "disable: button wrapper ARIA" ); + equal( button.attr( "tabindex" ), -1, "disable: button tabindex" ); + equal( menu.attr( "aria-disabled" ), "true", "disable: menu wrapper ARIA" ); - element.selectmenu("enable"); - ok( !element.selectmenu("option", "disabled"), "enable: widget option" ); - equal( element.attr("disabled"), undefined, "enable: native select disabled" ); - equal( button.attr("aria-disabled"), "false", "enable: button wrapper ARIA" ); - equal( button.attr("tabindex"), 0, "enable: button tabindex" ); - equal( menu.attr("aria-disabled"), "false", "enable: menu wrapper ARIA" ); + element.selectmenu( "enable" ); + ok( !element.selectmenu( "option", "disabled" ), "enable: widget option" ); + equal( element.attr( "disabled" ), undefined, "enable: native select disabled" ); + equal( button.attr( "aria-disabled" ), "false", "enable: button wrapper ARIA" ); + equal( button.attr( "tabindex" ), 0, "enable: button tabindex" ); + equal( menu.attr( "aria-disabled" ), "false", "enable: menu wrapper ARIA" ); }); -test("refresh - structure", function () { - expect(3); +test( "refresh - structure", function () { + expect( 3 ); - var element = $("#speed").selectmenu(), - menu = element.selectmenu("menuWidget").parent(); + var element = $( "#speed" ).selectmenu(), + menu = element.selectmenu( "menuWidget" ).parent(); - element.find("option").eq(2).remove(); - element.find("option").eq(3).remove(); - element.append(""); - element.find("option").first() - .attr("value", "changed_value") - .text("Changed value"); - element.selectmenu("refresh"); + element.find( "option" ).eq( 2 ).remove(); + element.find( "option" ).eq( 3 ).remove(); + element.append( "" ); + element.find( "option" ).first() + .attr( "value", "changed_value" ) + .text( "Changed value" ); + element.selectmenu( "refresh" ); - equal( element.find("option").length, menu.find("li").not(".ui-selectmenu-optgroup").length, "menu item length" ); - equal( element.find("option").last().text(), menu.find("li").not(".ui-selectmenu-optgroup").last().text(), "added item" ); - equal( element.find("option").first().text(), menu.find("li").not(".ui-selectmenu-optgroup").first().text(), "changed item" ); + equal( element.find( "option" ).length, menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).length, "menu item length" ); + equal( element.find( "option" ).last().text(), menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).last().text(), "added item" ); + equal( element.find( "option" ).first().text(), menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).first().text(), "changed item" ); }); -test("refresh - change selected option", function () { - expect(3); +test( "refresh - change selected option", function () { + expect( 3 ); - var element = $("#speed").selectmenu(), - menu = element.selectmenu("menuWidget").parent(), - button = element.selectmenu("widget"); - - equal( element.find("option:selected").text(), button.text(), "button text after init" ); - - button.simulate( "focus" ); - - equal( element.find("option:selected").text(), button.text(), "button text after focus" ); + var element = $( "#speed" ).selectmenu(), + menu = element.selectmenu( "menuWidget" ).parent(), + button = element.selectmenu( "widget" ); - element.find("option").eq(2).removeAttr("selected"); - element.find("option").eq(0).attr("selected", "selected"); - element.selectmenu("refresh"); - - equal( element.find("option:selected").text(), button.text(), "button text after changing selected option" ); + equal( element.find( "option:selected" ).text(), button.text(), "button text after init" ); + + button.simulate( "focus" ); + + equal( element.find( "option:selected" ).text(), button.text(), "button text after focus" ); + + element.find( "option" ).eq( 2 ).removeAttr( "selected" ); + element.find( "option" ).eq( 0 ).attr( "selected", "selected" ); + element.selectmenu( "refresh" ); + + equal( element.find( "option:selected" ).text(), button.text(), "button text after changing selected option" ); }); -test("refresh - disabled select", function () { - expect(4); +test( "refresh - disabled select", function () { + expect( 4 ); - var element = $("#speed").selectmenu(), - button = element.selectmenu("widget"), - menu = element.selectmenu("menuWidget"); + var element = $( "#speed" ).selectmenu(), + button = element.selectmenu( "widget" ), + menu = element.selectmenu( "menuWidget" ); - element.attr("disabled", "disabled"); - element.selectmenu("refresh"); + element.attr( "disabled", "disabled" ); + element.selectmenu( "refresh" ); - ok( element.selectmenu("option", "disabled"), "widget option" ); - equal( button.attr("aria-disabled"), "true", "button wrapper ARIA" ); - equal( button.attr("tabindex"), -1, "button tabindex" ); - equal( menu.attr("aria-disabled"), "true", "menu wrapper ARIA" ); + ok( element.selectmenu( "option", "disabled" ), "widget option" ); + equal( button.attr( "aria-disabled" ), "true", "button wrapper ARIA" ); + equal( button.attr( "tabindex" ), -1, "button tabindex" ); + equal( menu.attr( "aria-disabled" ), "true", "menu wrapper ARIA" ); }); -test("refresh - disabled option", function () { +test( "refresh - disabled option", function () { expect(1); var disabledItem, - element = $("#speed").selectmenu(), - menu = element.selectmenu("menuWidget").parent(); + element = $( "#speed" ).selectmenu(), + menu = element.selectmenu( "menuWidget" ).parent(); - element.attr("disabled", "disabled"); - element.find("option").eq(2).attr("disabled", "disabled"); - element.selectmenu("refresh"); + element.attr( "disabled", "disabled" ); + element.find( "option" ).eq( 2 ).attr( "disabled", "disabled" ); + element.selectmenu( "refresh" ); - disabledItem = menu.find("li").not(".ui-selectmenu-optgroup").eq(2); - ok( disabledItem.hasClass("ui-state-disabled"), "class" ); + disabledItem = menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).eq(2); + ok( disabledItem.hasClass( "ui-state-disabled" ), "class" ); }); -test("refresh - disabled optgroup", function () { +test( "refresh - disabled optgroup", function () { var i, item, - element = $("#files").selectmenu(), - menu = element.selectmenu("menuWidget").parent(), - originalDisabledOptgroup = element.find("optgroup").first(), - originalDisabledOptions = originalDisabledOptgroup.find("option"); + element = $( "#files" ).selectmenu(), + menu = element.selectmenu( "menuWidget" ).parent(), + originalDisabledOptgroup = element.find( "optgroup" ).first(), + originalDisabledOptions = originalDisabledOptgroup.find( "option" ); expect(2 + originalDisabledOptions.length); - originalDisabledOptgroup.attr("disabled", "disabled"); - element.selectmenu("refresh"); + originalDisabledOptgroup.attr( "disabled", "disabled" ); + element.selectmenu( "refresh" ); - item = menu.find("li.ui-selectmenu-optgroup").first(); - ok( item.hasClass("ui-state-disabled"), "class" ); + item = menu.find( "li.ui-selectmenu-optgroup" ).first(); + ok( item.hasClass( "ui-state-disabled" ), "class" ); - equal( menu.find("li").not(".ui-selectmenu-optgroup").filter(".ui-state-disabled").length, originalDisabledOptions.length, "disabled options" ); + equal( menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).filter( ".ui-state-disabled" ).length, originalDisabledOptions.length, "disabled options" ); for ( i = 0; i < originalDisabledOptions.length; i++ ) { - item = item.next("li"); - ok( item.hasClass("ui-state-disabled"), "item #" + i + ": class" ); + item = item.next( "li" ); + ok( item.hasClass( "ui-state-disabled" ), "item #" + i + ": class" ); } }); test( "widget", function() { expect( 4 ); - var element = $("#speed").selectmenu(), + var element = $( "#speed" ).selectmenu(), widgetElement = element.selectmenu( "widget" ), menuWidgetElement = element.selectmenu( "menuWidget" ); - element.selectmenu("refresh"); + element.selectmenu( "refresh" ); equal( widgetElement.length, 1, "widget: one element" ); - ok( widgetElement.is("a.ui-button"), "widget: button element" ); + ok( widgetElement.is( "a.ui-button" ), "widget: button element" ); equal( menuWidgetElement.length, 1, "menuWidget: one element" ); - ok( menuWidgetElement.is("ul.ui-menu"), "menuWidget: menu element" ); + ok( menuWidgetElement.is( "ul.ui-menu" ), "menuWidget: menu element" ); }); })( jQuery ); diff --git a/tests/unit/selectmenu/selectmenu_options.js b/tests/unit/selectmenu/selectmenu_options.js index ea40ebe00..dc87b8608 100644 --- a/tests/unit/selectmenu/selectmenu_options.js +++ b/tests/unit/selectmenu/selectmenu_options.js @@ -1,12 +1,12 @@ (function ($) { -module("selectmenu: options"); +module( "selectmenu: options" ); -test("appendTo another element", function () { +test( "appendTo another element", function () { expect( 8 ); - + var detached = $( "
" ), - element = $("#speed").selectmenu(); + element = $( "#speed" ).selectmenu(); equal( element.selectmenu( "menuWidget" ).parent().parent()[0], document.body, "defaults to body" ); element.selectmenu( "destroy" ); @@ -45,16 +45,16 @@ test("appendTo another element", function () { }); -test("CSS styles", function () { - expect(2); +test( "CSS styles", function () { + expect( 2 ); var element = $("#speed").selectmenu(), button = element.selectmenu("widget"), 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"); + 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" ); }); -})(jQuery); +})( jQuery );