Permalink
Browse files

Made sure that wait() behaves as documented (fixes #27)

  • Loading branch information...
1 parent 84d5efc commit 8a6fae1df98203aed53f831914eb69b8f0d07437 nzakas committed Apr 5, 2011
@@ -1948,13 +1948,16 @@ YUITest.TestCase.prototype = {
* @method wait
*/
wait : function (segment, delay){
- delay = (typeof delay == "number" ? delay : 10000);
- if (typeof segment == "function"){
- throw new YUITest.Wait(segment, delay);
+
+ var actualDelay = (typeof segment == "number" ? segment : delay);
+ actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
+
+ if (typeof segment == "function"){
+ throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITest.Wait(function(){
YUITest.Assert.fail("Timeout: wait() called but resume() never called.");
- }, delay);
+ }, actualDelay);
}
},
@@ -1946,13 +1946,16 @@ YUITest.TestCase.prototype = {
* @method wait
*/
wait : function (segment, delay){
- delay = (typeof delay == "number" ? delay : 10000);
- if (typeof segment == "function"){
- throw new YUITest.Wait(segment, delay);
+
+ var actualDelay = (typeof segment == "number" ? segment : delay);
+ actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
+
+ if (typeof segment == "function"){
+ throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITest.Wait(function(){
YUITest.Assert.fail("Timeout: wait() called but resume() never called.");
- }, delay);
+ }, actualDelay);
}
},

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1946,13 +1946,16 @@ YUITest.TestCase.prototype = {
* @method wait
*/
wait : function (segment, delay){
- delay = (typeof delay == "number" ? delay : 10000);
- if (typeof segment == "function"){
- throw new YUITest.Wait(segment, delay);
+
+ var actualDelay = (typeof segment == "number" ? segment : delay);
+ actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
+
+ if (typeof segment == "function"){
+ throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITest.Wait(function(){
YUITest.Assert.fail("Timeout: wait() called but resume() never called.");
- }, delay);
+ }, actualDelay);
}
},
@@ -1946,13 +1946,16 @@ YUITest.TestCase.prototype = {
* @method wait
*/
wait : function (segment, delay){
- delay = (typeof delay == "number" ? delay : 10000);
- if (typeof segment == "function"){
- throw new YUITest.Wait(segment, delay);
+
+ var actualDelay = (typeof segment == "number" ? segment : delay);
+ actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
+
+ if (typeof segment == "function"){
+ throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITest.Wait(function(){
YUITest.Assert.fail("Timeout: wait() called but resume() never called.");
- }, delay);
+ }, actualDelay);
}
},

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1948,13 +1948,16 @@ YUITest.TestCase.prototype = {
* @method wait
*/
wait : function (segment, delay){
- delay = (typeof delay == "number" ? delay : 10000);
- if (typeof segment == "function"){
- throw new YUITest.Wait(segment, delay);
+
+ var actualDelay = (typeof segment == "number" ? segment : delay);
+ actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
+
+ if (typeof segment == "function"){
+ throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITest.Wait(function(){
YUITest.Assert.fail("Timeout: wait() called but resume() never called.");
- }, delay);
+ }, actualDelay);
}
},

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1948,13 +1948,16 @@ YUITest.TestCase.prototype = {
* @method wait
*/
wait : function (segment, delay){
- delay = (typeof delay == "number" ? delay : 10000);
- if (typeof segment == "function"){
- throw new YUITest.Wait(segment, delay);
+
+ var actualDelay = (typeof segment == "number" ? segment : delay);
+ actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
+
+ if (typeof segment == "function"){
+ throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITest.Wait(function(){
YUITest.Assert.fail("Timeout: wait() called but resume() never called.");
- }, delay);
+ }, actualDelay);
}
},
@@ -1946,13 +1946,16 @@ YUITest.TestCase.prototype = {
* @method wait
*/
wait : function (segment, delay){
- delay = (typeof delay == "number" ? delay : 10000);
- if (typeof segment == "function"){
- throw new YUITest.Wait(segment, delay);
+
+ var actualDelay = (typeof segment == "number" ? segment : delay);
+ actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
+
+ if (typeof segment == "function"){
+ throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITest.Wait(function(){
YUITest.Assert.fail("Timeout: wait() called but resume() never called.");
- }, delay);
+ }, actualDelay);
}
},
@@ -65,13 +65,16 @@ YUITest.TestCase.prototype = {
* @method wait
*/
wait : function (segment, delay){
- delay = (typeof delay == "number" ? delay : 10000);
- if (typeof segment == "function"){
- throw new YUITest.Wait(segment, delay);
+
+ var actualDelay = (typeof segment == "number" ? segment : delay);
+ actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
+
+ if (typeof segment == "function"){
+ throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITest.Wait(function(){
YUITest.Assert.fail("Timeout: wait() called but resume() never called.");
- }, delay);
+ }, actualDelay);
}
},

0 comments on commit 8a6fae1

Please sign in to comment.