jquery-ui/tests/unit/button/core.js

28 lines
628 B
JavaScript
Raw Normal View History

define( [
2016-04-03 14:43:27 +00:00
"qunit",
"jquery",
"lib/helper",
"ui/widgets/button"
], function( QUnit, $, helper ) {
"use strict";
2010-01-20 14:00:14 +00:00
QUnit.module( "Button: core", { afterEach: helper.moduleAfterEach } );
2010-01-20 14:00:14 +00:00
2016-04-03 14:43:27 +00:00
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" );
2016-04-03 14:43:27 +00:00
ready();
} );
} );
} );