2015-04-06 18:27:05 +00:00
|
|
|
define( [
|
|
|
|
"jquery",
|
2015-07-15 02:04:22 +00:00
|
|
|
"ui/widgets/progressbar"
|
2015-04-06 18:27:05 +00:00
|
|
|
], function( $ ) {
|
2015-01-25 14:39:06 +00:00
|
|
|
|
2012-05-26 03:10:46 +00:00
|
|
|
module( "progressbar: events" );
|
2009-02-02 14:36:08 +00:00
|
|
|
|
2012-05-26 03:10:46 +00:00
|
|
|
test( "create", function() {
|
|
|
|
expect( 1 );
|
2015-08-24 12:58:48 +00:00
|
|
|
$( "#progressbar" ).progressbar( {
|
2010-11-22 13:49:47 +00:00
|
|
|
value: 5,
|
|
|
|
create: function() {
|
2012-12-06 14:50:33 +00:00
|
|
|
equal( $( this ).progressbar( "value" ), 5, "Correct value at create" );
|
2010-11-22 13:49:47 +00:00
|
|
|
},
|
|
|
|
change: function() {
|
2012-12-06 14:50:33 +00:00
|
|
|
ok( false, "create has triggered change()" );
|
2010-11-22 13:49:47 +00:00
|
|
|
}
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
|
|
|
} );
|
2010-11-22 13:49:47 +00:00
|
|
|
|
2012-05-26 03:10:46 +00:00
|
|
|
test( "change", function() {
|
2012-12-06 14:50:33 +00:00
|
|
|
expect( 2 );
|
|
|
|
var element = $( "#progressbar" ).progressbar();
|
|
|
|
|
|
|
|
element.one( "progressbarchange", function() {
|
|
|
|
equal( element.progressbar( "value" ), 5, "change triggered for middle value" );
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
2012-12-06 14:50:33 +00:00
|
|
|
element.progressbar( "value", 5 );
|
|
|
|
element.one( "progressbarchange", function() {
|
|
|
|
equal( element.progressbar( "value" ), 100, "change triggered for final value" );
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
2012-12-06 14:50:33 +00:00
|
|
|
element.progressbar( "value", 100 );
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
2009-02-02 14:36:08 +00:00
|
|
|
|
2010-09-27 14:44:04 +00:00
|
|
|
test( "complete", function() {
|
2012-12-06 14:50:33 +00:00
|
|
|
expect( 5 );
|
2012-05-26 03:10:46 +00:00
|
|
|
var value,
|
|
|
|
changes = 0,
|
2015-08-24 12:58:48 +00:00
|
|
|
element = $( "#progressbar" ).progressbar( {
|
2012-05-26 03:10:46 +00:00
|
|
|
change: function() {
|
|
|
|
changes++;
|
2012-12-06 14:50:33 +00:00
|
|
|
equal( element.progressbar( "value" ), value, "change at " + value );
|
2012-05-26 03:10:46 +00:00
|
|
|
},
|
|
|
|
complete: function() {
|
2012-03-27 02:51:16 +00:00
|
|
|
equal( changes, 3, "complete triggered after change and not on indeterminate" );
|
2012-12-06 14:50:33 +00:00
|
|
|
equal( element.progressbar( "value" ), 100, "value is 100" );
|
2012-05-26 03:10:46 +00:00
|
|
|
}
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
2012-02-28 14:56:32 +00:00
|
|
|
|
2010-09-27 14:44:04 +00:00
|
|
|
value = 5;
|
2012-05-26 03:10:46 +00:00
|
|
|
element.progressbar( "value", value );
|
2012-03-27 02:51:16 +00:00
|
|
|
value = false;
|
|
|
|
element.progressbar( "value", value );
|
2010-09-27 14:44:04 +00:00
|
|
|
value = 100;
|
2012-05-26 03:10:46 +00:00
|
|
|
element.progressbar( "value", value );
|
2015-08-24 12:58:48 +00:00
|
|
|
} );
|
2015-01-25 14:39:06 +00:00
|
|
|
|
2015-04-06 18:27:05 +00:00
|
|
|
} );
|