2015-04-06 18:27:05 +00:00
|
|
|
define( [
|
2016-04-06 13:08:28 +00:00
|
|
|
"qunit",
|
2015-04-06 18:27:05 +00:00
|
|
|
"jquery",
|
2015-07-15 02:04:22 +00:00
|
|
|
"ui/widgets/progressbar"
|
2016-04-06 13:08:28 +00:00
|
|
|
], function( QUnit, $ ) {
|
2015-01-25 14:39:06 +00:00
|
|
|
|
2016-04-06 13:08:28 +00:00
|
|
|
QUnit.module( "progressbar: methods" );
|
2009-02-02 14:36:08 +00:00
|
|
|
|
2016-04-06 13:08:28 +00:00
|
|
|
QUnit.test( "destroy", function( assert ) {
|
|
|
|
assert.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" );
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
|
|
|
} );
|
2009-02-02 14:36:08 +00:00
|
|
|
|
2016-04-06 13:08:28 +00:00
|
|
|
QUnit.test( "disable", function( assert ) {
|
|
|
|
assert.expect( 3 );
|
2013-03-14 23:08:21 +00:00
|
|
|
|
|
|
|
var element = $( "#progressbar" ).progressbar().progressbar( "disable" );
|
|
|
|
|
2015-03-10 14:23:43 +00:00
|
|
|
assert.hasClasses( element.progressbar( "widget" ), "ui-state-disabled" );
|
2016-04-06 13:08:28 +00:00
|
|
|
assert.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" );
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
2013-03-14 23:08:21 +00:00
|
|
|
|
2016-04-06 13:08:28 +00:00
|
|
|
QUnit.test( "value", function( assert ) {
|
|
|
|
assert.expect( 3 );
|
2012-02-28 14:56:32 +00:00
|
|
|
|
2015-08-24 12:58:48 +00:00
|
|
|
var element = $( "<div>" ).progressbar( { value: 20 } );
|
2016-04-06 13:08:28 +00:00
|
|
|
assert.equal( element.progressbar( "value" ), 20, "correct value as getter" );
|
|
|
|
assert.strictEqual( element.progressbar( "value", 30 ), element, "chainable as setter" );
|
|
|
|
assert.equal( element.progressbar( "option", "value" ), 30, "correct value after setter" );
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
2012-08-27 00:18:21 +00:00
|
|
|
|
2016-04-06 13:08:28 +00:00
|
|
|
QUnit.test( "widget", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2012-08-27 00:18:21 +00:00
|
|
|
var element = $( "#progressbar" ).progressbar(),
|
|
|
|
widgetElement = element.progressbar( "widget" );
|
2016-04-06 13:08:28 +00:00
|
|
|
assert.equal( widgetElement.length, 1, "one element" );
|
|
|
|
assert.strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" );
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
2015-01-25 14:39:06 +00:00
|
|
|
|
2015-04-06 18:27:05 +00:00
|
|
|
} );
|