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

43 lines
1.2 KiB
JavaScript
Raw Normal View History

define( [
"jquery",
"ui/widgets/progressbar"
], function( $ ) {
2012-05-26 03:10:46 +00:00
module( "progressbar: methods" );
test( "destroy", function( assert ) {
2012-05-26 03:10:46 +00:00
expect( 1 );
assert.domEqual( "#progressbar", function() {
2012-05-26 03:10:46 +00:00
$( "#progressbar" ).progressbar().progressbar( "destroy" );
});
});
test( "disable", function( assert ) {
expect( 3 );
var element = $( "#progressbar" ).progressbar().progressbar( "disable" );
assert.hasClasses( element.progressbar( "widget" ), "ui-state-disabled" );
ok( element.progressbar( "widget" ).attr( "aria-disabled" ), "element gets aria-disabled" );
assert.hasClasses( element.progressbar( "widget" ), "ui-progressbar-disabled" );
});
2012-05-26 03:10:46 +00:00
test( "value", function() {
expect( 3 );
2012-05-26 03:10:46 +00:00
var element = $( "<div>" ).progressbar({ value: 20 });
equal( element.progressbar( "value" ), 20, "correct value as getter" );
2012-12-06 14:50:33 +00:00
strictEqual( element.progressbar( "value", 30 ), element, "chainable as setter" );
2012-05-26 03:10:46 +00:00
equal( element.progressbar( "option", "value" ), 30, "correct value after setter" );
});
test( "widget", function() {
expect( 2 );
var element = $( "#progressbar" ).progressbar(),
widgetElement = element.progressbar( "widget" );
equal( widgetElement.length, 1, "one element" );
strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" );
});
} );