aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/button/events.js
blob: d778b4a2bf343492c88040d8e08862fc2e020b04 (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
25
26
27
28
29
30
31
32
33
34
35
36
define( [
	"jquery",
	"ui/widgets/button"
], function( $ ) {

module("button: events");

test("buttonset works with single-quote named elements (#7505)", function() {
	expect( 1 );
	$("#radio3").buttonset();
	$("#radio33").on( "click", function(){
		ok( true, "button clicks work with single-quote named elements" );
	}).trigger( "click" );
});

asyncTest( "when button loses focus, ensure active state is removed (#8559)", function( assert ) {
	expect( 1 );

	var element = $( "#button" ).button();

	element.one( "keypress", function() {
		element.one( "blur", function() {
			assert.lacksClasses( element, "ui-state-active", "button loses active state appropriately" );
			start();
		}).trigger( "blur" );
	});

	element.trigger( "focus" );
	setTimeout(function() {
		element
			.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } )
			.simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } );
	});
});

} );