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",
|
2020-05-16 07:16:24 +00:00
|
|
|
"lib/helper",
|
2015-07-15 01:57:20 +00:00
|
|
|
"ui/widgets/button"
|
2020-05-16 07:16:24 +00:00
|
|
|
], function( QUnit, $, helper ) {
|
2021-06-06 22:58:12 +00:00
|
|
|
"use strict";
|
2010-01-20 14:00:14 +00:00
|
|
|
|
2020-05-16 07:16:24 +00:00
|
|
|
QUnit.module( "Button: events", { afterEach: helper.moduleAfterEach } );
|
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
|
|
|
} );
|