2015-04-06 18:27:05 +00:00
|
|
|
define( [
|
|
|
|
"jquery",
|
|
|
|
"ui/progressbar"
|
|
|
|
], function( $ ) {
|
2015-01-25 14:39:06 +00:00
|
|
|
|
2012-05-26 03:10:46 +00:00
|
|
|
module( "progressbar: methods" );
|
2009-02-02 14:36:08 +00:00
|
|
|
|
2015-04-06 18:27:05 +00:00
|
|
|
test( "destroy", function( assert ) {
|
2012-05-26 03:10:46 +00:00
|
|
|
expect( 1 );
|
2015-04-06 18:27:05 +00:00
|
|
|
assert.domEqual( "#progressbar", function() {
|
2012-05-26 03:10:46 +00:00
|
|
|
$( "#progressbar" ).progressbar().progressbar( "destroy" );
|
|
|
|
});
|
2009-02-02 14:36:08 +00:00
|
|
|
});
|
|
|
|
|
2015-03-10 14:23:43 +00:00
|
|
|
test( "disable", function( assert ) {
|
2013-03-14 23:08:21 +00:00
|
|
|
expect( 3 );
|
|
|
|
|
|
|
|
var element = $( "#progressbar" ).progressbar().progressbar( "disable" );
|
|
|
|
|
2015-03-10 14:23:43 +00:00
|
|
|
assert.hasClasses( element.progressbar( "widget" ), "ui-state-disabled" );
|
2013-03-14 23:08:21 +00:00
|
|
|
ok( element.progressbar( "widget" ).attr( "aria-disabled" ), "element gets aria-disabled" );
|
2015-03-10 14:23:43 +00:00
|
|
|
assert.hasClasses( element.progressbar( "widget" ), "ui-progressbar-disabled" );
|
2013-03-14 23:08:21 +00:00
|
|
|
});
|
|
|
|
|
2012-05-26 03:10:46 +00:00
|
|
|
test( "value", function() {
|
|
|
|
expect( 3 );
|
2012-02-28 14:56:32 +00:00
|
|
|
|
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" );
|
2009-04-16 01:57:56 +00:00
|
|
|
});
|
2012-08-27 00:18:21 +00:00
|
|
|
|
|
|
|
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" );
|
|
|
|
});
|
2015-01-25 14:39:06 +00:00
|
|
|
|
2015-04-06 18:27:05 +00:00
|
|
|
} );
|