aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/button/core.js
blob: 98219c66cde76880393a45deccaccec75d74c848 (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
define( [
	"qunit",
	"jquery",
	"ui/safe-active-element",
	"ui/widgets/button"
], function( QUnit, $ ) {

QUnit.module( "Button: core" );

QUnit.test( "Disabled button loses focus", function( assert ) {
	var ready = assert.async();
	assert.expect( 2 );
	var element = $( "#button" ).button();

	element.trigger( "focus" );
	setTimeout( function() {

		assert.equal( element[ 0 ], $.ui.safeActiveElement( document ), "Button is focused" );

		element.button( "disable" );
		assert.notEqual( element[ 0 ], $.ui.safeActiveElement( document ), "Button has had focus removed" );
		ready();
	} );
} );

} );