aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/button/events.js
blob: 5774073614555501594c6013a83edcf4b7624eb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
define( [
	"qunit",
	"jquery",
	"lib/helper",
	"ui/widgets/button"
], function( QUnit, $, helper ) {

QUnit.module( "Button: events", { afterEach: helper.moduleAfterEach }  );

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();
		assert.ok( true, "click occcured as a result of spacebar" );
		ready();
	} );

	element.trigger( $.Event( "keyup", { keyCode: $.ui.keyCode.SPACE } ) );
} );

} );