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

35 lines
999 B
JavaScript
Raw Normal View History

define( [
"jquery",
"ui/widgets/button"
], function( $ ) {
2010-01-20 14:00:14 +00:00
module( "Button: methods" );
2010-01-20 14:00:14 +00:00
test( "destroy", function( assert ) {
expect( 1 );
assert.domEqual( "#button", function() {
$( "#button" ).button().button( "destroy" );
} );
} );
2010-01-20 14:00:14 +00:00
test( "refresh: Ensure disabled state is preserved correctly.", function() {
expect( 3 );
2013-03-26 18:43:35 +00:00
var element = $( "<a href='#'></a>" );
element.button( { disabled: true } ).button( "refresh" );
ok( element.button( "option", "disabled" ),
"Anchor button should remain disabled after refresh" );
element = $( "<button></button>" );
element.button( { disabled: true } ).button( "refresh" );
ok( element.button( "option", "disabled" ), "<button> should remain disabled after refresh" );
element = $( "<button></button>" );
element.button( { disabled: true } ).prop( "disabled", false ).button( "refresh" );
ok( !element.button( "option", "disabled" ),
"Changing a <button>'s disabled property should update the state after refresh." );
} );
} );