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

27 lines
591 B
JavaScript
Raw Permalink Normal View History

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