$( "#progressbar" ).progressbar({
value: 5,
create: function() {
- deepEqual( 5, $( this ).progressbar( "value" ) );
+ equal( $( this ).progressbar( "value" ), 5, "Correct value at create" );
},
change: function() {
- ok( false, "create() has triggered change()" );
+ ok( false, "create has triggered change()" );
}
});
});
test( "change", function() {
- expect( 1 );
- $( "#progressbar" ).progressbar({
- change: function() {
- deepEqual( 5, $( this ).progressbar( "value" ) );
- }
- }).progressbar( "value", 5 );
+ expect( 2 );
+ var element = $( "#progressbar" ).progressbar();
+
+ element.one( "progressbarchange", function() {
+ equal( element.progressbar( "value" ), 5, "change triggered for middle value" );
+ });
+ element.progressbar( "value", 5 );
+ element.one( "progressbarchange", function() {
+ equal( element.progressbar( "value" ), 100, "change triggered for final value" );
+ });
+ element.progressbar( "value", 100 );
});
test( "complete", function() {
- expect( 4 );
+ expect( 5 );
var value,
changes = 0,
element = $( "#progressbar" ).progressbar({
change: function() {
changes++;
- deepEqual( element.progressbar( "value" ), value, "change at " + value );
+ equal( element.progressbar( "value" ), value, "change at " + value );
},
complete: function() {
equal( changes, 3, "complete triggered after change and not on indeterminate" );
+ equal( element.progressbar( "value" ), 100, "value is 100" );
}
});
module( "progressbar: options" );
-test( "{ value : 0 }, default", function() {
+test( "{ value: 0 }, default", function() {
expect( 1 );
$( "#progressbar" ).progressbar();
- equal( 0, $( "#progressbar" ).progressbar( "value" ) );
+ equal( $( "#progressbar" ).progressbar( "value" ), 0 );
});
// Ticket #7231 - valueDiv should be hidden when value is at 0%
test( "value: visibility of valueDiv", function() {
- expect( 5 );
+ expect( 4 );
var element = $( "#progressbar" ).progressbar({
value: 0
});
element.progressbar( "value", 0 );
ok( element.children( ".ui-progressbar-value" ).is( ":hidden" ),
"valueDiv hidden when value is set to 0" );
- element.progressbar( "value", -1 );
- ok( element.children( ".ui-progressbar-value" ).is( ":hidden" ),
- "valueDiv hidden when value set to -1 (normalizes to 0)" );
});
-test( "{ value : 5 }", function() {
+test( "{ value: 5 }", function() {
expect( 1 );
$( "#progressbar" ).progressbar({
value: 5
});
- equal( 5, $( "#progressbar" ).progressbar( "value" ) );
+ equal( $( "#progressbar" ).progressbar( "value" ), 5 );
});
-test( "{ value : -5 }", function() {
+test( "{ value: -5 }", function() {
expect( 1 );
$( "#progressbar" ).progressbar({
value: -5
});
- deepEqual( 0, $( "#progressbar" ).progressbar( "value" ) );
+ equal( $( "#progressbar" ).progressbar( "value" ), 0,
+ "value constrained at min" );
});
-test( "{ value : 105 }", function() {
+test( "{ value: 105 }", function() {
expect( 1 );
$( "#progressbar" ).progressbar({
value: 105
});
- deepEqual( 100, $( "#progressbar" ).progressbar( "value" ) );
-});
-
-test( "{ max : 5, value : 10 }", function() {
- expect( 1 );
- $("#progressbar").progressbar({
- max: 5,
- value: 10
- });
- deepEqual( 5, $( "#progressbar" ).progressbar( "value" ) );
+ equal( $( "#progressbar" ).progressbar( "value" ), 100,
+ "value constrained at max" );
});
-test( "{ value : 10, max : 5 }", function() {
+test( "{ value: 10, max: 5 }", function() {
expect( 1 );
$("#progressbar").progressbar({
max: 5,
value: 10
});
- deepEqual( 5, $( "#progressbar" ).progressbar( "value" ) );
+ equal( $( "#progressbar" ).progressbar( "value" ), 5,
+ "value constrained at max" );
});
-test( "{ max : 5 }", function() {
+test( "change max below value", function() {
expect( 1 );
$("#progressbar").progressbar({
max: 10,
value: 10
}).progressbar( "option", "max", 5 );
- deepEqual( 5, $( "#progressbar" ).progressbar( "value" ) );
+ equal( $( "#progressbar" ).progressbar( "value" ), 5,
+ "value constrained at max" );
});