aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/progressbar/progressbar_options.js
blob: 815606ec66c0e840d8a625ce35d5fa1f24aec402 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * progressbar_options.js
 */
(function($) {

module("progressbar: options");

test("{ value : 0 }, default", function() {
	$("#progressbar").progressbar();
	deepEqual( 0, $("#progressbar").progressbar("value") );
});

// 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)" );
});

test("{ value : 5 }", function() {
	$("#progressbar").progressbar({
		value: 5
	});
	deepEqual( 5, $("#progressbar").progressbar("value") );
});

test("{ value : -5 }", function() {
	$("#progressbar").progressbar({
		value: -5
	});
	deepEqual( 0, $("#progressbar").progressbar("value") );
});

test("{ value : 105 }", function() {
	$("#progressbar").progressbar({
		value: 105
	});
	deepEqual( 100, $("#progressbar").progressbar("value") );
});

test("{ max : 5, value : 10 }", function() {
	$("#progressbar").progressbar({
		max: 5,
		value: 10
	});
	deepEqual( 5, $("#progressbar").progressbar("value") );
});

})(jQuery);