Skip to content
Permalink
Browse files

Selectmenu Tests: add spaces to [0]

  • Loading branch information...
fnagel committed Apr 29, 2013
1 parent b8339eb commit 4c930fd59b9d2985074a3ad2d665f111d9d7d64c
@@ -20,7 +20,7 @@ test("accessibility", function () {
equal( button.attr( "aria-owns" ), menu.attr("id"), "button link aria-owns" );
equal(
button.attr( "aria-labelledby" ),
links.eq( element[0].selectedIndex ).attr( "id" ),
links.eq( element[ 0 ].selectedIndex ).attr( "id" ),
"button link aria-labelledby"
);
equal( button.attr( "tabindex" ), 0, "button link tabindex" );
@@ -13,7 +13,7 @@ test( "change", function () {
change: function ( event, ui ) {
ok( event, "change event fired on change" );
equal( event.type, "selectmenuchange", "event type set to selectmenuchange" );
equal( ui.item.element[ 0 ].nodeName.toLowerCase(), "option", "ui.item.element[0] points to original option element" );
equal( ui.item.element[ 0 ].nodeName.toLowerCase(), "option", "ui.item.element[ 0 ] points to original option element" );
equal( ui.item.value, value, "ui.item.value property updated correctly" );
}
});
@@ -50,7 +50,7 @@ test( "focus", function () {
focus: function ( event, ui ) {
ok( event, "focus event fired on mouseover" );
equal( event.type, "selectmenufocus", "event type set to selectmenufocus" );
equal( ui.item.element[0].nodeName.toLowerCase(), "option", "ui points to original option element" );
equal( ui.item.element[ 0 ].nodeName.toLowerCase(), "option", "ui points to original option element" );
}
});

@@ -89,7 +89,7 @@ test( "select", function () {
select: function ( event, ui ) {
ok( event, "select event fired on item select" );
equal( event.type, "selectmenuselect", "event type set to selectmenuselect" );
equal( ui.item.element[0].nodeName.toLowerCase(), "option", "ui points to original option element" );
equal( ui.item.element[ 0 ].nodeName.toLowerCase(), "option", "ui points to original option element" );
}
});

@@ -7,40 +7,40 @@ test( "appendTo another element", function () {

var detached = $( "<div>" ),
element = $( "#speed" ).selectmenu();
equal( element.selectmenu( "menuWidget" ).parent().parent()[0], document.body, "defaults to body" );
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], document.body, "defaults to body" );
element.selectmenu( "destroy" );

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" );

$( "#selectmenu-wrap2" ).addClass( "ui-front" );
element.selectmenu();
equal( element.selectmenu( "menuWidget" ).parent().parent()[0], $( "#selectmenu-wrap2" )[0], "null, inside .ui-front" );
equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], $( "#selectmenu-wrap2" )[ 0 ], "null, inside .ui-front" );
element.selectmenu( "destroy" );
$( "#selectmenu-wrap2" ).removeClass( "ui-front" );

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" );
});

0 comments on commit 4c930fd

Please sign in to comment.
You can’t perform that action at this time.