2015-04-06 14:13:15 +00:00
|
|
|
define( [
|
2016-04-03 14:43:27 +00:00
|
|
|
"qunit",
|
2015-04-06 14:13:15 +00:00
|
|
|
"jquery",
|
2015-07-15 01:57:20 +00:00
|
|
|
"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 );
|
2014-01-22 17:02:32 +00:00
|
|
|
var element = $( "#anchor-button" ).button();
|
2012-11-21 13:33:43 +00:00
|
|
|
|
2015-10-06 12:30:41 +00:00
|
|
|
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();
|
2015-08-21 04:12:35 +00:00
|
|
|
} );
|
2012-12-10 15:35:01 +00:00
|
|
|
|
2014-01-22 17:02:32 +00:00
|
|
|
element.trigger( $.Event( "keyup", { keyCode: $.ui.keyCode.SPACE } ) );
|
2015-08-21 04:12:35 +00:00
|
|
|
} );
|
2012-11-21 13:33:43 +00:00
|
|
|
|
2015-04-06 14:13:15 +00:00
|
|
|
} );
|