diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-12-06 09:50:33 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-12-06 09:50:33 -0500 |
commit | 9d0df536240f1b5e84d1f772ef95117280acd4d8 (patch) | |
tree | a6a7917b23dcf33f739f37c43af887179fa935c1 /tests | |
parent | f1be88e7956fe9114ae20d19242cd8190a6ff399 (diff) | |
download | jquery-ui-9d0df536240f1b5e84d1f772ef95117280acd4d8.tar.gz jquery-ui-9d0df536240f1b5e84d1f772ef95117280acd4d8.zip |
Progress tests: Cleanup.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/progressbar/progressbar_events.js | 26 | ||||
-rw-r--r-- | tests/unit/progressbar/progressbar_methods.js | 2 | ||||
-rw-r--r-- | tests/unit/progressbar/progressbar_options.js | 42 |
3 files changed, 34 insertions, 36 deletions
diff --git a/tests/unit/progressbar/progressbar_events.js b/tests/unit/progressbar/progressbar_events.js index fe05182a1..95effda75 100644 --- a/tests/unit/progressbar/progressbar_events.js +++ b/tests/unit/progressbar/progressbar_events.js @@ -5,34 +5,40 @@ test( "create", function() { $( "#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" ); } }); diff --git a/tests/unit/progressbar/progressbar_methods.js b/tests/unit/progressbar/progressbar_methods.js index 990739c6e..cf7faf6af 100644 --- a/tests/unit/progressbar/progressbar_methods.js +++ b/tests/unit/progressbar/progressbar_methods.js @@ -12,7 +12,7 @@ test( "value", function() { var element = $( "<div>" ).progressbar({ value: 20 }); 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" ); }); diff --git a/tests/unit/progressbar/progressbar_options.js b/tests/unit/progressbar/progressbar_options.js index e4d9b7ab8..bc0b5d00d 100644 --- a/tests/unit/progressbar/progressbar_options.js +++ b/tests/unit/progressbar/progressbar_options.js @@ -1,14 +1,14 @@ 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 }); @@ -23,58 +23,50 @@ test( "value: visibility of valueDiv", function() { 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" ); }); |