2009-02-02 14:36:08 +00:00
|
|
|
/*
|
|
|
|
* progressbar_options.js
|
|
|
|
*/
|
|
|
|
(function($) {
|
|
|
|
|
|
|
|
module("progressbar: options");
|
|
|
|
|
2009-02-04 04:39:31 +00:00
|
|
|
test("{ value : 0 }, default", function() {
|
2009-09-11 18:47:34 +00:00
|
|
|
$("#progressbar").progressbar();
|
2012-02-28 14:56:32 +00:00
|
|
|
deepEqual( 0, $("#progressbar").progressbar("value") );
|
2009-09-11 18:47:34 +00:00
|
|
|
});
|
|
|
|
|
2011-04-09 18:53:15 +00:00
|
|
|
// Ticket #7231 - valueDiv should be hidden when value is at 0%
|
|
|
|
test( "value: visibility of valueDiv", function() {
|
|
|
|
expect( 5 );
|
|
|
|
var element = $( "#progressbar" ).progressbar({
|
|
|
|
value: 0
|
|
|
|
});
|
|
|
|
ok( element.children( ".ui-progressbar-value" ).is( ":hidden" ), "valueDiv hidden when value is initialized at 0" );
|
|
|
|
element.progressbar( "value", 1 );
|
|
|
|
ok( element.children( ".ui-progressbar-value" ).is( ":visible" ), "valueDiv visible when value is set to 1" );
|
|
|
|
element.progressbar( "value", 100 );
|
|
|
|
ok( element.children( ".ui-progressbar-value" ).is( ":visible" ), "valueDiv visible when value is set to 100" );
|
|
|
|
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)" );
|
|
|
|
});
|
|
|
|
|
2009-09-11 18:47:34 +00:00
|
|
|
test("{ value : 5 }", function() {
|
|
|
|
$("#progressbar").progressbar({
|
|
|
|
value: 5
|
|
|
|
});
|
2012-02-28 14:56:32 +00:00
|
|
|
deepEqual( 5, $("#progressbar").progressbar("value") );
|
2009-02-02 14:36:08 +00:00
|
|
|
});
|
|
|
|
|
2010-07-29 09:38:24 +00:00
|
|
|
test("{ value : -5 }", function() {
|
|
|
|
$("#progressbar").progressbar({
|
|
|
|
value: -5
|
|
|
|
});
|
2012-02-28 14:56:32 +00:00
|
|
|
deepEqual( 0, $("#progressbar").progressbar("value") );
|
2010-07-29 09:38:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test("{ value : 105 }", function() {
|
|
|
|
$("#progressbar").progressbar({
|
|
|
|
value: 105
|
|
|
|
});
|
2012-02-28 14:56:32 +00:00
|
|
|
deepEqual( 100, $("#progressbar").progressbar("value") );
|
2010-07-29 09:38:24 +00:00
|
|
|
});
|
|
|
|
|
2010-11-22 13:49:47 +00:00
|
|
|
test("{ max : 5, value : 10 }", function() {
|
|
|
|
$("#progressbar").progressbar({
|
|
|
|
max: 5,
|
|
|
|
value: 10
|
|
|
|
});
|
2012-02-28 14:56:32 +00:00
|
|
|
deepEqual( 5, $("#progressbar").progressbar("value") );
|
2010-11-22 13:49:47 +00:00
|
|
|
});
|
|
|
|
|
2009-02-02 14:36:08 +00:00
|
|
|
})(jQuery);
|