Permalink
Browse files

Updated the testcases.

Added a new timer testcase, the 1.6.1 version failed this one. But its fixed in the latest release.

Besure to test the cases atleast 5x. As the timer test gave random issues in the 1.6.1 version
  • Loading branch information...
1 parent 65b72ce commit 221a6fe32a9485396a4e5c44b50dfe7500c890f8 Arnout Kazemier committed May 25, 2010
Showing with 125 additions and 4 deletions.
  1. +7 −2 tests/1.6.1/observer.html
  2. +55 −0 tests/1.6.1/timer.html
  3. +7 −2 tests/1.7/observer.html
  4. +56 −0 tests/1.7/timer.html
@@ -38,7 +38,7 @@
})
}
};
-
+ t.assertEqual( 100, progress.percentage );
progress.addObserver( observer );
setTimeout( function(){ progress.reset(); }, 500 );
},
@@ -64,12 +64,17 @@
test_4onPercentageSet: function( t ){
t.pause();
- setTimeout( function(){ progress.setPercentage( "70%", 5000 ); progress.addObserver( observer ); }, 1500 );
+ setTimeout( function(){
+ t.assertEqual( 0, progress.percentage );
+ progress.setPercentage( "70%", 5000 );
+ progress.addObserver( observer );
+ }, 1500 );
var observer = {
onPercentageSet: function( osbserver, data ){
t.resume( function(){
t.assertEqual( 70, data );
+ t.assertEqual( 70, progress.percentage );
progress.removeObserver( observer );
})
}
View
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Test: increasing the percentage</title>
+<link type="text/css" rel="stylesheet" href="../../shared/default.css" />
+<script type="text/javascript" src="../../1.6.1/SpryDOMUtils.js"></script>
+<script type="text/javascript" src="../../1.6.1/SpryEffects.js"></script>
+<script type="text/javascript" src="../../1.6.1/SpryProgressBar.js"></script>
+
+<!-- used for the test cases -->
+<script type="text/javascript" src="../../shared/evidence.js"></script>
+<script type="text/javascript">
+Evidence.TestCase.extend( 'animation_times', {
+ test_30Percentage: function( t ){
+ var bar = Spry.$$( "#example1 .bar" );
+
+ t.pause();
+
+ progress.setPercentage( 80, 10000 );
+
+ setTimeout( function(){
+ t.resume( function(){
+ t.assert( parseFloat( bar[0].style.width ) < 150 );
+ });
+ }, 2300 )
+ },
+
+ test_halfbar: function( t ){
+
+ var bar = Spry.$$( "#example1 .bar" );
+
+ t.pause();
+
+ setTimeout( function(){
+ t.resume( function(){
+ t.assert( parseFloat( bar[0].style.width ) < 275 );
+ });
+ }, 3000 )
+ }
+});
+</script>
+</head>
+
+<body>
+<div class="progress" id="example1">
+ <span class="bar"><b></b></span>
+</div>
+
+<script type="text/javascript">
+// construct the progress bars
+var progress = new Spry.Widget.ProgressBar( "#example1" );
+</script>
+</body>
+</html>
View
@@ -39,7 +39,7 @@
})
}
};
-
+ t.assertEqual( 100, progress.percentage );
progress.addObserver( observer );
setTimeout( function(){ progress.reset(); }, 500 );
},
@@ -65,12 +65,17 @@
test_4onPercentageSet: function( t ){
t.pause();
- setTimeout( function(){ progress.setPercentage( "70%", 5000 ); progress.addObserver( observer ); }, 1500 );
+ setTimeout( function(){
+ t.assertEqual( 0, progress.percentage );
+ progress.setPercentage( "70%", 5000 );
+ progress.addObserver( observer );
+ }, 1500 );
var observer = {
onPercentageSet: function( osbserver, data ){
t.resume( function(){
t.assertEqual( 70, data );
+ t.assertEqual( 70, progress.percentage );
progress.removeObserver( observer );
})
}
View
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Test: increasing the percentage</title>
+<link type="text/css" rel="stylesheet" href="../../shared/default.css" />
+<script type="text/javascript" src="../../1.7/SpryDOMUtils.js"></script>
+<script type="text/javascript" src="../../1.7/SpryDOMEffects.js"></script>
+<script type="text/javascript" src="../../1.7/SpryWidget.js"></script>
+<script type="text/javascript" src="../../1.7/SpryProgressBar.js"></script>
+
+<!-- used for the test cases -->
+<script type="text/javascript" src="../../shared/evidence.js"></script>
+<script type="text/javascript">
+Evidence.TestCase.extend( 'animation_times', {
+ test_30Percentage: function( t ){
+ var bar = Spry.$$( "#example1 .bar" );
+
+ t.pause();
+
+ progress.setPercentage( 80, 10000 );
+
+ setTimeout( function(){
+ t.resume( function(){
+ t.assert( parseFloat( bar[0].style.width ) < 150 );
+ });
+ }, 2300 )
+ },
+
+ test_halfbar: function( t ){
+
+ var bar = Spry.$$( "#example1 .bar" );
+
+ t.pause();
+
+ setTimeout( function(){
+ t.resume( function(){
+ t.assert( parseFloat( bar[0].style.width ) < 275 );
+ });
+ }, 3000 )
+ }
+});
+</script>
+</head>
+
+<body>
+<div class="progress" id="example1">
+ <span class="bar"></span>
+</div>
+
+<script type="text/javascript">
+// construct the progress bars
+var progress = new Spry.Widget.ProgressBar( "#example1" );
+</script>
+</body>
+</html>

0 comments on commit 221a6fe

Please sign in to comment.