2015-04-06 14:13:15 +00:00
|
|
|
define( [
|
|
|
|
"jquery",
|
2015-01-08 02:51:38 +00:00
|
|
|
"ui/safe-active-element",
|
2015-07-15 01:57:20 +00:00
|
|
|
"ui/widgets/button"
|
2015-04-06 14:13:15 +00:00
|
|
|
], function( $ ) {
|
2010-01-20 14:00:14 +00:00
|
|
|
|
2014-01-22 17:02:32 +00:00
|
|
|
module( "Button: core" );
|
2010-01-20 14:00:14 +00:00
|
|
|
|
2014-01-22 17:02:32 +00:00
|
|
|
asyncTest( "Disabled button loses focus", function() {
|
2012-06-27 15:32:48 +00:00
|
|
|
expect( 2 );
|
2014-01-22 17:02:32 +00:00
|
|
|
var element = $( "#button" ).button();
|
2013-04-07 16:57:15 +00:00
|
|
|
|
2014-01-22 17:02:32 +00:00
|
|
|
element.focus();
|
2015-08-21 04:12:35 +00:00
|
|
|
setTimeout( function() {
|
2013-04-07 16:57:15 +00:00
|
|
|
|
2014-01-22 17:02:32 +00:00
|
|
|
equal( element[ 0 ], $.ui.safeActiveElement( document ), "Button is focused" );
|
2012-12-08 01:06:29 +00:00
|
|
|
|
2013-04-11 18:03:51 +00:00
|
|
|
element.button( "disable" );
|
2014-01-22 17:02:32 +00:00
|
|
|
notEqual( element[ 0 ], $.ui.safeActiveElement( document ), "Button has had focus removed" );
|
2013-04-11 18:03:51 +00:00
|
|
|
start();
|
2015-08-21 04:12:35 +00:00
|
|
|
} );
|
|
|
|
} );
|
2013-04-11 18:03:51 +00:00
|
|
|
|
2015-04-06 14:13:15 +00:00
|
|
|
} );
|