mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Progress tests: Cleanup.
This commit is contained in:
parent
f1be88e795
commit
9d0df53624
@ -5,34 +5,40 @@ test( "create", function() {
|
|||||||
$( "#progressbar" ).progressbar({
|
$( "#progressbar" ).progressbar({
|
||||||
value: 5,
|
value: 5,
|
||||||
create: function() {
|
create: function() {
|
||||||
deepEqual( 5, $( this ).progressbar( "value" ) );
|
equal( $( this ).progressbar( "value" ), 5, "Correct value at create" );
|
||||||
},
|
},
|
||||||
change: function() {
|
change: function() {
|
||||||
ok( false, "create() has triggered change()" );
|
ok( false, "create has triggered change()" );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "change", function() {
|
test( "change", function() {
|
||||||
expect( 1 );
|
expect( 2 );
|
||||||
$( "#progressbar" ).progressbar({
|
var element = $( "#progressbar" ).progressbar();
|
||||||
change: function() {
|
|
||||||
deepEqual( 5, $( this ).progressbar( "value" ) );
|
element.one( "progressbarchange", function() {
|
||||||
}
|
equal( element.progressbar( "value" ), 5, "change triggered for middle value" );
|
||||||
}).progressbar( "value", 5 );
|
});
|
||||||
|
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() {
|
test( "complete", function() {
|
||||||
expect( 4 );
|
expect( 5 );
|
||||||
var value,
|
var value,
|
||||||
changes = 0,
|
changes = 0,
|
||||||
element = $( "#progressbar" ).progressbar({
|
element = $( "#progressbar" ).progressbar({
|
||||||
change: function() {
|
change: function() {
|
||||||
changes++;
|
changes++;
|
||||||
deepEqual( element.progressbar( "value" ), value, "change at " + value );
|
equal( element.progressbar( "value" ), value, "change at " + value );
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
equal( changes, 3, "complete triggered after change and not on indeterminate" );
|
equal( changes, 3, "complete triggered after change and not on indeterminate" );
|
||||||
|
equal( element.progressbar( "value" ), 100, "value is 100" );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ test( "value", function() {
|
|||||||
|
|
||||||
var element = $( "<div>" ).progressbar({ value: 20 });
|
var element = $( "<div>" ).progressbar({ value: 20 });
|
||||||
equal( element.progressbar( "value" ), 20, "correct value as getter" );
|
equal( element.progressbar( "value" ), 20, "correct value as getter" );
|
||||||
equal( element.progressbar( "value", 30), element, "chainable as setter" );
|
strictEqual( element.progressbar( "value", 30 ), element, "chainable as setter" );
|
||||||
equal( element.progressbar( "option", "value" ), 30, "correct value after setter" );
|
equal( element.progressbar( "option", "value" ), 30, "correct value after setter" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3,12 +3,12 @@ module( "progressbar: options" );
|
|||||||
test( "{ value: 0 }, default", function() {
|
test( "{ value: 0 }, default", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
$( "#progressbar" ).progressbar();
|
$( "#progressbar" ).progressbar();
|
||||||
equal( 0, $( "#progressbar" ).progressbar( "value" ) );
|
equal( $( "#progressbar" ).progressbar( "value" ), 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ticket #7231 - valueDiv should be hidden when value is at 0%
|
// Ticket #7231 - valueDiv should be hidden when value is at 0%
|
||||||
test( "value: visibility of valueDiv", function() {
|
test( "value: visibility of valueDiv", function() {
|
||||||
expect( 5 );
|
expect( 4 );
|
||||||
var element = $( "#progressbar" ).progressbar({
|
var element = $( "#progressbar" ).progressbar({
|
||||||
value: 0
|
value: 0
|
||||||
});
|
});
|
||||||
@ -23,9 +23,6 @@ test( "value: visibility of valueDiv", function() {
|
|||||||
element.progressbar( "value", 0 );
|
element.progressbar( "value", 0 );
|
||||||
ok( element.children( ".ui-progressbar-value" ).is( ":hidden" ),
|
ok( element.children( ".ui-progressbar-value" ).is( ":hidden" ),
|
||||||
"valueDiv hidden when value is set to 0" );
|
"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() {
|
||||||
@ -33,7 +30,7 @@ test( "{ value : 5 }", function() {
|
|||||||
$( "#progressbar" ).progressbar({
|
$( "#progressbar" ).progressbar({
|
||||||
value: 5
|
value: 5
|
||||||
});
|
});
|
||||||
equal( 5, $( "#progressbar" ).progressbar( "value" ) );
|
equal( $( "#progressbar" ).progressbar( "value" ), 5 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ value: -5 }", function() {
|
test( "{ value: -5 }", function() {
|
||||||
@ -41,7 +38,8 @@ test( "{ value : -5 }", function() {
|
|||||||
$( "#progressbar" ).progressbar({
|
$( "#progressbar" ).progressbar({
|
||||||
value: -5
|
value: -5
|
||||||
});
|
});
|
||||||
deepEqual( 0, $( "#progressbar" ).progressbar( "value" ) );
|
equal( $( "#progressbar" ).progressbar( "value" ), 0,
|
||||||
|
"value constrained at min" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ value: 105 }", function() {
|
test( "{ value: 105 }", function() {
|
||||||
@ -49,16 +47,8 @@ test( "{ value : 105 }", function() {
|
|||||||
$( "#progressbar" ).progressbar({
|
$( "#progressbar" ).progressbar({
|
||||||
value: 105
|
value: 105
|
||||||
});
|
});
|
||||||
deepEqual( 100, $( "#progressbar" ).progressbar( "value" ) );
|
equal( $( "#progressbar" ).progressbar( "value" ), 100,
|
||||||
});
|
"value constrained at max" );
|
||||||
|
|
||||||
test( "{ max : 5, value : 10 }", function() {
|
|
||||||
expect( 1 );
|
|
||||||
$("#progressbar").progressbar({
|
|
||||||
max: 5,
|
|
||||||
value: 10
|
|
||||||
});
|
|
||||||
deepEqual( 5, $( "#progressbar" ).progressbar( "value" ) );
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ value: 10, max: 5 }", function() {
|
test( "{ value: 10, max: 5 }", function() {
|
||||||
@ -67,14 +57,16 @@ test( "{ value : 10, max : 5 }", function() {
|
|||||||
max: 5,
|
max: 5,
|
||||||
value: 10
|
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 );
|
expect( 1 );
|
||||||
$("#progressbar").progressbar({
|
$("#progressbar").progressbar({
|
||||||
max: 10,
|
max: 10,
|
||||||
value: 10
|
value: 10
|
||||||
}).progressbar( "option", "max", 5 );
|
}).progressbar( "option", "max", 5 );
|
||||||
deepEqual( 5, $( "#progressbar" ).progressbar( "value" ) );
|
equal( $( "#progressbar" ).progressbar( "value" ), 5,
|
||||||
|
"value constrained at max" );
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user