jquery-ui/tests/unit/button/events.js

24 lines
534 B
JavaScript
Raw Normal View History

define( [
2016-04-03 14:43:27 +00:00
"qunit",
"jquery",
"ui/widgets/button"
2016-04-03 14:43:27 +00:00
], function( QUnit, $ ) {
2010-01-20 14:00:14 +00:00
2016-04-03 14:43:27 +00:00
QUnit.module( "Button: events" );
2010-01-20 14:00:14 +00:00
2016-04-03 14:43:27 +00:00
QUnit.test( "Anchor recieves click event when spacebar is pressed", function( assert ) {
var ready = assert.async();
assert.expect( 1 );
var element = $( "#anchor-button" ).button();
element.on( "click", function( event ) {
event.preventDefault();
2016-04-03 14:43:27 +00:00
assert.ok( true, "click occcured as a result of spacebar" );
ready();
} );
element.trigger( $.Event( "keyup", { keyCode: $.ui.keyCode.SPACE } ) );
} );
} );