Selectmenu Tests: use trigger instead of simulate for click events in order to make tests work in IE/ and IE8

This commit is contained in:
Felix Nagel 2013-07-01 22:04:30 +02:00
parent b735152ae1
commit 2c9f5a8c01
2 changed files with 9 additions and 9 deletions

View File

@ -100,7 +100,7 @@ $.each([
setTimeout(function() { setTimeout(function() {
links = menu.find("li.ui-menu-item a"); links = menu.find("li.ui-menu-item a");
button.simulate( "click" ); button.trigger( "click" );
menu.find( "a" ).last().simulate( "mouseover" ).trigger( "click" ); menu.find( "a" ).last().simulate( "mouseover" ).trigger( "click" );
equal( equal(
menu.attr( "aria-activedescendant" ), menu.attr( "aria-activedescendant" ),
@ -137,10 +137,10 @@ $.each([
setTimeout(function() { setTimeout(function() {
links = menu.find( "li.ui-menu-item a" ); links = menu.find( "li.ui-menu-item a" );
// open menu and click first item // open menu and click first item
button.simulate( "click" ); button.trigger( "click" );
links.first().simulate( "mouseover" ).trigger( "click" ); links.first().simulate( "mouseover" ).trigger( "click" );
// open menu again and hover item // open menu again and hover item
button.simulate( "click" ); button.trigger( "click" );
links.eq( 3 ).simulate( "mouseover" ); links.eq( 3 ).simulate( "mouseover" );
// 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 } );

View File

@ -29,8 +29,8 @@ asyncTest( "change", function () {
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout(function() {
button.simulate( "click" ); button.trigger( "click" );
menu.find( "a" ).eq( optionIndex ).simulate( "mouseover" ).simulate( "click" ); menu.find( "a" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" );
start(); start();
}, 1 ); }, 1 );
}); });
@ -49,7 +49,7 @@ test( "close", function () {
this.element.selectmenu( "open" ).selectmenu( "close" ); this.element.selectmenu( "open" ).selectmenu( "close" );
this.element.selectmenu( "open" ); this.element.selectmenu( "open" );
$( "body" ).simulate( "click" ); $( "body" ).trigger( "click" );
}); });
@ -78,7 +78,7 @@ asyncTest( "focus", function () {
setTimeout(function() { setTimeout(function() {
button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
button.simulate( "click" ); button.trigger( "click" );
links = menu.find( "li.ui-menu-item a" ); links = menu.find( "li.ui-menu-item a" );
optionIndex = 0; optionIndex = 0;
links.eq( optionIndex ).simulate( "mouseover" ); links.eq( optionIndex ).simulate( "mouseover" );
@ -126,8 +126,8 @@ asyncTest( "select", function () {
button.simulate( "focus" ); button.simulate( "focus" );
setTimeout(function() { setTimeout(function() {
button.simulate( "click" ); button.trigger( "click" );
menu.find( "a" ).eq( optionIndex ).simulate( "mouseover" ).simulate( "click" ); menu.find( "a" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" );
start(); start();
}, 1 ); }, 1 );
}); });