diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-08-24 08:50:24 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-09-11 08:29:07 -0400 |
commit | cfd48ed037db9a573a3495cb2fae773e3de9bb38 (patch) | |
tree | e8914402d86ee187cf211f6cb08db8e332982027 | |
parent | 9b82001a70a6273df037db9e602080011d0fd7ba (diff) | |
download | jquery-ui-cfd48ed037db9a573a3495cb2fae773e3de9bb38.tar.gz jquery-ui-cfd48ed037db9a573a3495cb2fae773e3de9bb38.zip |
Selectmenu: Style updates
Ref #14246
-rw-r--r-- | tests/unit/selectmenu/common.js | 2 | ||||
-rw-r--r-- | tests/unit/selectmenu/core.js | 74 | ||||
-rw-r--r-- | tests/unit/selectmenu/events.js | 46 | ||||
-rw-r--r-- | tests/unit/selectmenu/methods.js | 26 | ||||
-rw-r--r-- | tests/unit/selectmenu/options.js | 28 |
5 files changed, 88 insertions, 88 deletions
diff --git a/tests/unit/selectmenu/common.js b/tests/unit/selectmenu/common.js index 8582247ca..97a47f2a6 100644 --- a/tests/unit/selectmenu/common.js +++ b/tests/unit/selectmenu/common.js @@ -29,6 +29,6 @@ common.testWidget( "selectmenu", { open: null, select: null } -}); +} ); } ); diff --git a/tests/unit/selectmenu/core.js b/tests/unit/selectmenu/core.js index 96e83f69b..5431d689d 100644 --- a/tests/unit/selectmenu/core.js +++ b/tests/unit/selectmenu/core.js @@ -18,15 +18,15 @@ test( "markup structure", function( assert ) { assert.lacksClasses( button, "ui-selectmenu-button-open" ); assert.hasClasses( menuWrap, "ui-selectmenu-menu" ); assert.lacksClasses( menuWrap, "ui-selectmenu-menu-open" ); -}); +} ); asyncTest( "accessibility", function() { var wrappers, button, menu, 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 ); - }); + } ); element.selectmenu(); button = element.selectmenu( "widget" ); @@ -37,7 +37,7 @@ asyncTest( "accessibility", function() { expect( 13 + wrappers.length * 3 ); - setTimeout(function() { + setTimeout( function() { equal( button.attr( "role" ), "combobox", "button role" ); equal( button.attr( "aria-haspopup" ), "true", "button aria-haspopup" ); equal( button.attr( "aria-expanded" ), "false", "button aria-expanded" ); @@ -62,13 +62,13 @@ asyncTest( "accessibility", function() { ); $.each( wrappers, function( index ) { var item = $( this ); - equal( item.attr( "role" ), "option", "menu item #" + index +" role" ); - equal( item.attr( "tabindex" ), -1, "menu item #" + index +" tabindex" ); + equal( item.attr( "role" ), "option", "menu item #" + index + " role" ); + equal( item.attr( "tabindex" ), -1, "menu item #" + index + " tabindex" ); equal( item.attr( "title" ), "A demo title #" + index, "menu item #" + index + " title" ); - }); + } ); start(); - }); -}); + } ); +} ); test( "_renderButtonItem()", function() { expect( 2 ); @@ -102,9 +102,9 @@ test( "_renderButtonItem()", function() { button.text(), "click: button item text" ); -}); +} ); -$.each([ +$.each( [ { type: "default", selector: "#speed" @@ -127,7 +127,7 @@ $.each([ selected = element.find( "option:selected" ).next(); button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); @@ -143,13 +143,13 @@ $.each([ ); equal( element.find( "option:selected" ).val(), - selected.val() , + selected.val(), "original select state" ); equal( button.text(), selected.text(), "button text" ); start(); - }); - }); + } ); + } ); asyncTest( "state synchronization - after click on item - " + settings.type, function() { expect( 4 ); @@ -161,7 +161,7 @@ $.each([ selected = element.find( "option" ).last(); button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); button.trigger( "click" ); @@ -184,7 +184,7 @@ $.each([ equal( button.text(), selected.text(), "button text" ); start(); }, 1 ); - }); + } ); asyncTest( "state synchronization - " + "after focus item and keydown on button - " + settings.type, function() { @@ -199,7 +199,7 @@ $.each([ // Init menu button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); // Open menu and click first item @@ -213,20 +213,20 @@ $.each([ // Close and use keyboard control on button button.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); equal( menu.attr( "aria-activedescendant" ), wrappers.eq( 1 ).attr( "id" ), "menu aria-activedescendant" ); equal( button.attr( "aria-activedescendant" ), wrappers.eq( 1 ).attr( "id" ), "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" ); equal( button.text(), options.eq( 1 ).text(), "button text" ); start(); - }); - }); - }); + } ); + } ); + } ); asyncTest( "item looping - " + settings.type, function() { expect( 4 ); @@ -237,7 +237,7 @@ $.each([ menu = element.selectmenu( "menuWidget" ); button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); button.trigger( "click" ); @@ -252,8 +252,8 @@ $.each([ button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); equal( element[ 0 ].selectedIndex, wrappers.length - 1, "No looping behind last item" ); start(); - }); - }); + } ); + } ); asyncTest( "item focus and active state - " + settings.type, function() { expect( 4 ); @@ -264,11 +264,11 @@ $.each([ menu = element.selectmenu( "menuWidget" ); button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { wrappers = menu.find( "li.ui-menu-item .ui-menu-item-wrapper" ); button.trigger( "click" ); - setTimeout(function() { + setTimeout( function() { checkItemClasses(); wrappers.eq( 3 ).simulate( "mouseover" ).trigger( "click" ); @@ -282,12 +282,12 @@ $.each([ $( document ).trigger( "click" ); button.trigger( "click" ); - setTimeout(function() { + setTimeout( function() { checkItemClasses(); start(); - }); - }); - }); + } ); + } ); + } ); function checkItemClasses() { 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" ), "selected item has ui-state-focus class" ); } - }); + } ); asyncTest( "empty option - " + settings.type, function( assert ) { expect( 7 ); @@ -309,7 +309,7 @@ $.each([ menu = element.selectmenu( "menuWidget" ); button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { wrappers = menu.find( "li:not(.ui-selectmenu-optgroup) .ui-menu-item-wrapper" ); wrapper = wrappers.first(); @@ -325,8 +325,8 @@ $.each([ equal( wrapper.attr( "role" ), "option", "empty item has role option" ); start(); - }); - }); -}); + } ); + } ); +} ); } ); diff --git a/tests/unit/selectmenu/events.js b/tests/unit/selectmenu/events.js index 2ab20c46c..2d4a3f7fc 100644 --- a/tests/unit/selectmenu/events.js +++ b/tests/unit/selectmenu/events.js @@ -7,7 +7,7 @@ module( "selectmenu: events", { setup: function() { this.element = $( "#speed" ); } -}); +} ); asyncTest( "change", function() { expect( 3 ); @@ -15,15 +15,15 @@ asyncTest( "change", function() { var button, menu, options, optionIndex = 1; - this.element.selectmenu({ - change: function ( event, ui ) { + this.element.selectmenu( { + change: function( event, ui ) { equal( ui.item.index, optionIndex, "ui.item.index contains correct option index" ); equal( ui.item.element[ 0 ], options.eq( optionIndex )[ 0 ], "ui.item.element contains original option element" ); equal( ui.item.value, options.eq( optionIndex ).text(), "ui.item.value property updated correctly" ); } - }); + } ); button = this.element.selectmenu( "widget" ); menu = this.element.selectmenu( "menuWidget" ); @@ -31,23 +31,23 @@ asyncTest( "change", function() { button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { button.trigger( "click" ); menu.find( "li" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" ); start(); - }); -}); + } ); +} ); test( "close", function() { expect( 2 ); var shouldFire; - this.element.selectmenu({ + this.element.selectmenu( { close: function() { ok( shouldFire, "close event fired on close" ); } - }); + } ); shouldFire = false; this.element.selectmenu( "open" ); @@ -57,7 +57,7 @@ test( "close", function() { this.element.selectmenu( "open" ); shouldFire = true; $( "body" ).trigger( "mousedown" ); -}); +} ); asyncTest( "focus", function() { expect( 9 ); @@ -67,20 +67,20 @@ asyncTest( "focus", function() { optionIndex = this.element[ 0 ].selectedIndex + 1, options = this.element.find( "option" ); - this.element.selectmenu({ + this.element.selectmenu( { focus: function( event, ui ) { ok( true, "focus event fired on element #" + optionIndex + " mouseover" ); equal( ui.item.index, optionIndex, "ui.item.index contains correct option index" ); equal( ui.item.element[ 0 ], options.eq( optionIndex )[ 0 ], "ui.item.element contains original option element" ); } - }); + } ); button = this.element.selectmenu( "widget" ); menu = this.element.selectmenu( "menuWidget" ); button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); button.trigger( "click" ); @@ -93,32 +93,32 @@ asyncTest( "focus", function() { // This tests for unwanted, additional focus event on close that.element.selectmenu( "close" ); start(); - }); -}); + } ); +} ); test( "open", function() { expect( 1 ); - this.element.selectmenu({ + this.element.selectmenu( { open: function() { ok( true, "open event fired on open" ); } - }); + } ); this.element.selectmenu( "open" ); -}); +} ); asyncTest( "select", function() { expect( 3 ); - this.element.selectmenu({ + this.element.selectmenu( { select: function( event, ui ) { ok( true, "select event fired on item select" ); equal( ui.item.index, optionIndex, "ui.item.index contains correct option index" ); equal( ui.item.element[ 0 ], options.eq( optionIndex )[ 0 ], "ui.item.element contains original option element" ); } - }); + } ); var button = this.element.selectmenu( "widget" ), menu = this.element.selectmenu( "menuWidget" ), @@ -126,11 +126,11 @@ asyncTest( "select", function() { optionIndex = 1; button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { button.trigger( "click" ); menu.find( "li" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" ); start(); - }); -}); + } ); +} ); } ); diff --git a/tests/unit/selectmenu/methods.js b/tests/unit/selectmenu/methods.js index a386655ce..e49da50f5 100644 --- a/tests/unit/selectmenu/methods.js +++ b/tests/unit/selectmenu/methods.js @@ -9,8 +9,8 @@ test( "destroy", function( assert ) { expect( 1 ); assert.domEqual( "#speed", function() { $( "#speed" ).selectmenu().selectmenu( "destroy" ); - }); -}); + } ); +} ); test( "open / close", function() { expect( 5 ); @@ -27,7 +27,7 @@ test( "open / close", function() { element.selectmenu( "close" ); ok( menu.is( ":hidden" ), "close: menu hidden" ); equal( menu.attr( "aria-hidden" ), "true", "close: menu aria-disabled" ); -}); +} ); test( "enable / disable", function() { expect( 10 ); @@ -49,7 +49,7 @@ test( "enable / disable", function() { equal( button.attr( "aria-disabled" ), "false", "enable: button ARIA" ); equal( button.attr( "tabindex" ), 0, "enable: button tabindex" ); equal( menu.attr( "aria-disabled" ), "false", "enable: menu ARIA" ); -}); +} ); test( "refresh - structure", function() { expect( 3 ); @@ -73,7 +73,7 @@ test( "refresh - structure", function() { equal( options.length, menuItems.length, "menu item length" ); equal( "Added option", menuItems.last().text(), "added item" ); equal( "Changed value", menuItems.eq( 0 ).text(), "changed item" ); -}); +} ); asyncTest( "refresh - change selected option", function() { expect( 4 ); @@ -84,7 +84,7 @@ asyncTest( "refresh - change selected option", function() { equal( element.find( "option:selected" ).text(), button.text(), "button text after init" ); button.simulate( "focus" ); - setTimeout(function() { + setTimeout( function() { equal( element.find( "option:selected" ).text(), button.text(), "button text after focus" ); 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" ); start(); - }); -}); + } ); +} ); test( "refresh - disabled select", function() { expect( 4 ); @@ -115,7 +115,7 @@ test( "refresh - disabled select", function() { equal( button.attr( "aria-disabled" ), "true", "button ARIA" ); equal( button.attr( "tabindex" ), -1, "button tabindex" ); equal( menu.attr( "aria-disabled" ), "true", "menu ARIA" ); -}); +} ); test( "refresh - disabled option", function( assert ) { expect( 1 ); @@ -129,7 +129,7 @@ test( "refresh - disabled option", function( assert ) { disabledItem = menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).eq( 2 ); assert.hasClasses( disabledItem, "ui-state-disabled" ); -}); +} ); test( "refresh - disabled optgroup", function( assert ) { var i, item, @@ -156,7 +156,7 @@ test( "refresh - disabled optgroup", function( assert ) { item = item.next( "li" ); assert.hasClasses( item, "ui-state-disabled" ); } -}); +} ); test( "refresh - remove all options", function() { expect( 2 ); @@ -170,7 +170,7 @@ test( "refresh - remove all options", function() { equal( button.find( ".ui-selectmenu-text" ).html(), $( "<span> </span>" ).html(), "Empty button text" ); equal( menu.children().length, 0, "Empty menu" ); -}); +} ); test( "widget and menuWidget", function( assert ) { expect( 4 ); @@ -184,6 +184,6 @@ test( "widget and menuWidget", function( assert ) { equal( menu.length, 1, "Menu Widget: one element" ); ok( menu.is( "ul.ui-menu" ), "Menu Widget: element and class" ); -}); +} ); } ); diff --git a/tests/unit/selectmenu/options.js b/tests/unit/selectmenu/options.js index be2565e37..0ac13ed6d 100644 --- a/tests/unit/selectmenu/options.js +++ b/tests/unit/selectmenu/options.js @@ -11,7 +11,7 @@ test( "appendTo: null", function() { var element = $( "#speed" ).selectmenu(); equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], document.body, "defaults to body" ); -}); +} ); test( "appendTo: explicit", function() { expect( 6 ); @@ -19,9 +19,9 @@ test( "appendTo: explicit", function() { var detached = $( "<div>" ), element = $( "#speed" ); - element.selectmenu({ + element.selectmenu( { appendTo: ".selectmenu-wrap" - }); + } ); 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" ); @@ -32,16 +32,16 @@ test( "appendTo: explicit", function() { $( "#selectmenu-wrap1" )[ 0 ], "modified after init" ); element.selectmenu( "destroy" ); - element.selectmenu({ + element.selectmenu( { appendTo: detached - }); + } ); equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ], "detached jQuery object" ); element.selectmenu( "destroy" ); - element.selectmenu({ + element.selectmenu( { appendTo: detached[ 0 ] - }); + } ); equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ], "detached DOM element" ); element.selectmenu( "destroy" ); @@ -50,7 +50,7 @@ test( "appendTo: explicit", function() { equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ], "detached DOM element via option()" ); element.selectmenu( "destroy" ); -}); +} ); test( "appendTo: ui-front", function() { expect( 2 ); @@ -63,12 +63,12 @@ test( "appendTo: ui-front", function() { $( "#selectmenu-wrap2" )[ 0 ], "null, inside .ui-front" ); element.selectmenu( "destroy" ); - element.selectmenu({ + element.selectmenu( { appendTo: $() - }); + } ); equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap2" )[ 0 ], "empty jQuery object, inside .ui-front" ); -}); +} ); test( "CSS styles", function( assert ) { 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( menu, "ui-corner-bottom" ); assert.lacksClasses( button, "ui-corner-all" ); -}); +} ); test( "width", function() { expect( 6 ); @@ -120,9 +120,9 @@ test( "width", function() { element .selectmenu( "destroy" ) .css( "width", "100%" ) - .selectmenu({ width: null }); + .selectmenu( { width: null } ); button = element.selectmenu( "widget" ); equal( button.outerWidth(), 300, "button width fills container" ); -}); +} ); } ); |