aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/button/core.js
blob: ae4b870eda939a7097759588dc64225080b4fd5a (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
define( [
	"qunit",
	"jquery",
	"lib/helper",
	"ui/widgets/button"
], function( QUnit, $, helper ) {
"use strict";

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

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 ], document.activeElement, "Button is focused" );

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

} );