]> source.dussan.org Git - jquery-ui.git/commitdiff
Selectmenu Tests: cleanup unit tests
authorFelix Nagel <info@felixnagel.com>
Mon, 29 Apr 2013 18:47:02 +0000 (20:47 +0200)
committerFelix Nagel <info@felixnagel.com>
Mon, 29 Apr 2013 18:47:02 +0000 (20:47 +0200)
tests/unit/selectmenu/selectmenu_common.js
tests/unit/selectmenu/selectmenu_core.js
tests/unit/selectmenu/selectmenu_events.js

index af76aa58186c03c7fd088447b3c11c4ef1bb4671..e34dd37fbe044a3b6dfb0f97fa681fe6b86e86fa 100644 (file)
@@ -10,6 +10,7 @@ TestHelpers.commonWidgetTests( "selectmenu", {
                        at: "left bottom",
                        collision: "none"
                },
+
                // callbacks
                create: null,
                change: null,
index 14b2750193d3ef08e19d4905dcb30388db865baa..69414f1b28456a22466b7d2eaed2f239f2633d68 100644 (file)
@@ -15,17 +15,25 @@ test("accessibility", function () {
 
        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-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( "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" );
+       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" );
@@ -56,9 +64,21 @@ $.each([
                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( 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( 
+                       menu.attr( "aria-activedescendant" ), 
+                       links.eq( element[ 0 ].selectedIndex ).attr( "id" ), 
+                       "menu aria-activedescendant" 
+               );
+               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" );
        });
 
@@ -75,13 +95,25 @@ $.each([
 
                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( 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( 
+                       menu.attr( "aria-activedescendant" ), 
+                       links.eq( element[ 0 ].selectedIndex ).attr( "id" ), 
+                       "menu aria-activedescendant" 
+               );
+               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(4);
 
                var links,
index f33e66b2596e859e2d7ced0a8eec1d803ba59409..a5b8163d29c3b80b45816fa25f78afa6068b8815 100644 (file)
@@ -1,4 +1,4 @@
-(function ($) {
+(function ( $ ) {
 
 module( "selectmenu: events", {
        setup: function () {