2015-04-06 14:13:15 +00:00
|
|
|
define( [
|
|
|
|
"jquery",
|
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
|
|
|
|
2015-08-21 04:12:35 +00:00
|
|
|
module( "button: events" );
|
2010-01-20 14:00:14 +00:00
|
|
|
|
2015-08-21 04:12:35 +00:00
|
|
|
test( "buttonset works with single-quote named elements (#7505)", function() {
|
2012-11-19 13:37:41 +00:00
|
|
|
expect( 1 );
|
2015-08-21 04:12:35 +00:00
|
|
|
$( "#radio3" ).buttonset();
|
|
|
|
$( "#radio33" ).on( "click", function() {
|
2012-11-19 13:37:41 +00:00
|
|
|
ok( true, "button clicks work with single-quote named elements" );
|
2015-08-21 04:12:35 +00:00
|
|
|
} ).trigger( "click" );
|
|
|
|
} );
|
2012-11-19 13:37:41 +00:00
|
|
|
|
2015-02-03 00:25:52 +00:00
|
|
|
asyncTest( "when button loses focus, ensure active state is removed (#8559)", function( assert ) {
|
2012-11-21 13:33:43 +00:00
|
|
|
expect( 1 );
|
|
|
|
|
2012-12-10 15:35:01 +00:00
|
|
|
var element = $( "#button" ).button();
|
|
|
|
|
|
|
|
element.one( "keypress", function() {
|
|
|
|
element.one( "blur", function() {
|
2015-02-03 00:25:52 +00:00
|
|
|
assert.lacksClasses( element, "ui-state-active", "button loses active state appropriately" );
|
2012-12-10 15:35:01 +00:00
|
|
|
start();
|
2015-08-21 04:12:35 +00:00
|
|
|
} ).trigger( "blur" );
|
|
|
|
} );
|
2012-12-10 15:35:01 +00:00
|
|
|
|
2015-05-14 01:54:37 +00:00
|
|
|
element.trigger( "focus" );
|
2015-08-21 04:12:35 +00:00
|
|
|
setTimeout( function() {
|
2012-12-10 15:35:01 +00:00
|
|
|
element
|
|
|
|
.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } )
|
|
|
|
.simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } );
|
2015-08-21 04:12:35 +00:00
|
|
|
} );
|
|
|
|
} );
|
2012-11-21 13:33:43 +00:00
|
|
|
|
2015-04-06 14:13:15 +00:00
|
|
|
} );
|