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
|
|
|
|
2014-01-22 17:02:32 +00:00
|
|
|
module( "Button: methods" );
|
2010-01-20 14:00:14 +00:00
|
|
|
|
2015-08-21 04:12:35 +00:00
|
|
|
test( "destroy", function( assert ) {
|
2012-06-16 12:24:29 +00:00
|
|
|
expect( 1 );
|
2015-04-06 14:13:15 +00:00
|
|
|
assert.domEqual( "#button", function() {
|
2012-06-16 12:24:29 +00:00
|
|
|
$( "#button" ).button().button( "destroy" );
|
2015-08-21 04:12:35 +00:00
|
|
|
} );
|
|
|
|
} );
|
2010-01-20 14:00:14 +00:00
|
|
|
|
2012-11-19 20:42:28 +00:00
|
|
|
test( "refresh: Ensure disabled state is preserved correctly.", function() {
|
2014-01-22 17:02:32 +00:00
|
|
|
expect( 3 );
|
2013-03-26 18:43:35 +00:00
|
|
|
|
2012-11-19 20:42:28 +00:00
|
|
|
var element = $( "<a href='#'></a>" );
|
2015-08-21 04:12:35 +00:00
|
|
|
element.button( { disabled: true } ).button( "refresh" );
|
2014-01-22 17:02:32 +00:00
|
|
|
ok( element.button( "option", "disabled" ),
|
|
|
|
"Anchor button should remain disabled after refresh" );
|
2012-11-19 20:42:28 +00:00
|
|
|
|
|
|
|
element = $( "<button></button>" );
|
2015-08-21 04:12:35 +00:00
|
|
|
element.button( { disabled: true } ).button( "refresh" );
|
|
|
|
ok( element.button( "option", "disabled" ), "<button> should remain disabled after refresh" );
|
2012-11-19 20:42:28 +00:00
|
|
|
|
|
|
|
element = $( "<button></button>" );
|
2015-08-21 04:12:35 +00:00
|
|
|
element.button( { disabled: true } ).prop( "disabled", false ).button( "refresh" );
|
2014-01-22 17:02:32 +00:00
|
|
|
ok( !element.button( "option", "disabled" ),
|
|
|
|
"Changing a <button>'s disabled property should update the state after refresh." );
|
2014-04-01 18:42:38 +00:00
|
|
|
|
2015-08-21 04:12:35 +00:00
|
|
|
} );
|
2014-04-01 18:42:38 +00:00
|
|
|
|
2015-04-06 14:13:15 +00:00
|
|
|
} );
|