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

29 lines
679 B
JavaScript
Raw Normal View History

define( [
2016-04-03 14:43:27 +00:00
"qunit",
"jquery",
"lib/helper",
"ui/safe-active-element",
"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() {
2016-04-03 14:43:27 +00:00
assert.equal( element[ 0 ], $.ui.safeActiveElement( document ), "Button is focused" );
element.button( "disable" );
2016-04-03 14:43:27 +00:00
assert.notEqual( element[ 0 ], $.ui.safeActiveElement( document ), "Button has had focus removed" );
ready();
} );
} );
} );