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

44 lines
937 B
JavaScript
Raw Normal View History

2012-05-26 03:10:46 +00:00
module( "progressbar: events" );
2012-05-26 03:10:46 +00:00
test( "create", function() {
expect( 1 );
$( "#progressbar" ).progressbar({
value: 5,
create: function() {
2012-05-26 03:10:46 +00:00
deepEqual( 5, $( this ).progressbar( "value" ) );
},
change: function() {
2012-05-26 03:10:46 +00:00
ok( false, "create() has triggered change()" );
}
2012-04-19 02:46:39 +00:00
});
});
2012-05-26 03:10:46 +00:00
test( "change", function() {
expect( 1 );
$( "#progressbar" ).progressbar({
2009-09-11 18:47:34 +00:00
change: function() {
2012-05-26 03:10:46 +00:00
deepEqual( 5, $( this ).progressbar( "value" ) );
2009-09-11 18:47:34 +00:00
}
2012-05-26 03:10:46 +00:00
}).progressbar( "value", 5 );
});
test( "complete", function() {
expect( 3 );
2012-05-26 03:10:46 +00:00
var value,
changes = 0,
element = $( "#progressbar" ).progressbar({
change: function() {
changes++;
deepEqual( element.progressbar( "value" ), value, "change at " + value );
},
complete: function() {
equal( changes, 2, "complete triggered after change" );
}
});
value = 5;
2012-05-26 03:10:46 +00:00
element.progressbar( "value", value );
value = 100;
2012-05-26 03:10:46 +00:00
element.progressbar( "value", value );
});