Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 8a6fae1df98203aed53f831914eb69b8f0d07437 1 parent 84d5efc
@nzakas authored
View
11 javascript/build/yuitest/npm/lib/yuitest-node.js
@@ -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);
}
},
View
11 javascript/build/yuitest/yuitest-core-debug.js
@@ -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);
}
},
View
2  javascript/build/yuitest/yuitest-core-min.js
@@ -1,5 +1,5 @@
var YUITest={version:"@VERSION@"};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(A,B){if(typeof this._handlers[A]=="undefined"){this._handlers[A]=[];}this._handlers[A].push(B);},subscribe:function(A,B){this.attach.apply(this,arguments);},fire:function(D){if(typeof D=="string"){D={type:D};}if(!D.target){D.target=this;}if(!D.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[D.type] instanceof Array){var B=this._handlers[D.type];for(var C=0,A=B.length;C<A;C++){B[C].call(this,D);}}},detach:function(D,E){if(this._handlers[D] instanceof Array){var B=this._handlers[D];for(var C=0,A=B.length;C<A;C++){if(B[C]===E){B.splice(C,1);break;}}}},unsubscribe:function(A,B){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(B,A){for(var C in A){if(A.hasOwnProperty(C)){B[C]=A[C];}}return B;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.AssertionError=function(A){this.message=A;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(B,A,C){YUITest.AssertionError.call(this,B);this.expected=A;this.actual=C;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(A){YUITest.AssertionError.call(this,A||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(A){YUITest.AssertionError.call(this,A||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(A){YUITest.AssertionError.call(this,"Unexpected error: "+A.message);this.cause=A;this.name="UnexpectedError";this.stack=A.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(B,A){YUITest.AssertionError.call(this,B);this.unexpected=A;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(B,A){this.segment=(typeof B=="function"?B:null);this.delay=(typeof A=="number"?A:0);};YUITest.Assert={_asserts:0,_formatMessage:function(B,A){if(typeof B=="string"&&B.length>0){return B.replace("{message}",A);}else{return A;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(A){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(A,"Test force-failed."));},areEqual:function(B,C,A){YUITest.Assert._increment();if(B!=C){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Values should be equal."),B,C);}},areNotEqual:function(A,C,B){YUITest.Assert._increment();if(A==C){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(B,"Values should not be equal."),A);}},areNotSame:function(A,C,B){YUITest.Assert._increment();if(A===C){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(B,"Values should not be the same."),A);}},areSame:function(B,C,A){YUITest.Assert._increment();if(B!==C){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Values should be the same."),B,C);}},isFalse:function(B,A){YUITest.Assert._increment();if(false!==B){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be false."),false,B);}},isTrue:function(B,A){YUITest.Assert._increment();if(true!==B){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be true."),true,B);}},isNaN:function(B,A){YUITest.Assert._increment();if(!isNaN(B)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be NaN."),NaN,B);}},isNotNaN:function(B,A){YUITest.Assert._increment();if(isNaN(B)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Values should not be NaN."),NaN);}},isNotNull:function(B,A){YUITest.Assert._increment();if(B===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Values should not be null."),null);}},isNotUndefined:function(B,A){YUITest.Assert._increment();if(typeof B=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should not be undefined."),undefined);}},isNull:function(B,A){YUITest.Assert._increment();if(B!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be null."),null,B);}},isUndefined:function(B,A){YUITest.Assert._increment();if(typeof B!="undefined"){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be undefined."),undefined,B);}},isArray:function(C,B){YUITest.Assert._increment();var A=false;if(Array.isArray){A=!Array.isArray(C);}else{A=Object.prototype.toString.call(C)!="[object Array]";}if(A){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(B,"Value should be an array."),C);}},isBoolean:function(B,A){YUITest.Assert._increment();if(typeof B!="boolean"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a Boolean."),B);}},isFunction:function(B,A){YUITest.Assert._increment();if(!(B instanceof Function)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a function."),B);
}},isInstanceOf:function(B,C,A){YUITest.Assert._increment();if(!(C instanceof B)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value isn't an instance of expected type."),B,C);}},isNumber:function(B,A){YUITest.Assert._increment();if(typeof B!="number"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a number."),B);}},isObject:function(B,A){YUITest.Assert._increment();if(!B||(typeof B!="object"&&typeof B!="function")){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be an object."),B);}},isString:function(B,A){YUITest.Assert._increment();if(typeof B!="string"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a string."),B);}},isTypeOf:function(A,C,B){YUITest.Assert._increment();if(typeof C!=A){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(B,"Value should be of type "+A+"."),A,typeof C);}},throwsError:function(D,E,C){YUITest.Assert._increment();var A=false;try{E();}catch(B){if(typeof D=="string"){if(B.message!=D){A=true;}}else{if(typeof D=="function"){if(!(B instanceof D)){A=true;}}else{if(typeof D=="object"&&D!==null){if(!(B instanceof D.constructor)||B.message!=D.message){A=true;}}else{A=true;}}}if(A){throw new YUITest.UnexpectedError(B);}else{return;}}throw new YUITest.AssertionError(YUITest.Assert._formatMessage(C,"Error should have been thrown."));}};YUITest.ArrayAssert={_indexOf:function(B,C){if(B.indexOf){return B.indexOf(C);}else{for(var A=0;A<B.length;A++){if(B[A]===C){return A;}}return -1;}},_some:function(B,C){if(B.some){return B.some(C);}else{for(var A=0;A<B.length;A++){if(C(B[A])){return true;}}return false;}},contains:function(C,B,A){YUITest.Assert._increment();if(this._indexOf(B,C)==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Value "+C+" ("+(typeof C)+") not found in array ["+B+"]."));}},containsItems:function(C,D,B){YUITest.Assert._increment();for(var A=0;A<C.length;A++){if(this._indexOf(D,C[A])==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Value "+C[A]+" ("+(typeof C[A])+") not found in array ["+D+"]."));}}},containsMatch:function(C,B,A){YUITest.Assert._increment();if(typeof C!="function"){throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");}if(!this._some(B,C)){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"No match found in array ["+B+"]."));}},doesNotContain:function(C,B,A){YUITest.Assert._increment();if(this._indexOf(B,C)>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Value found in array ["+B+"]."));}},doesNotContainItems:function(C,D,B){YUITest.Assert._increment();for(var A=0;A<C.length;A++){if(this._indexOf(D,C[A])>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Value found in array ["+D+"]."));}}},doesNotContainMatch:function(C,B,A){YUITest.Assert._increment();if(typeof C!="function"){throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");}if(this._some(B,C)){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Value found in array ["+B+"]."));}},indexOf:function(E,D,A,C){YUITest.Assert._increment();for(var B=0;B<D.length;B++){if(D[B]===E){if(A!=B){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value exists at index "+B+" but should be at index "+A+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value doesn't exist in array ["+D+"]."));},itemsAreEqual:function(C,D,B){YUITest.Assert._increment();if(C.length!=D.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Array should have a length of "+C.length+" but has a length of "+D.length));}for(var A=0;A<C.length;A++){if(C[A]!=D[A]){throw new YUITest.Assert.ComparisonFailure(YUITest.Assert._formatMessage(B,"Values in position "+A+" are not equal."),C[A],D[A]);}}},itemsAreEquivalent:function(D,E,A,C){YUITest.Assert._increment();if(typeof A!="function"){throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");}if(D.length!=E.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Array should have a length of "+D.length+" but has a length of "+E.length));}for(var B=0;B<D.length;B++){if(!A(D[B],E[B])){throw new YUITest.Assert.ComparisonFailure(YUITest.Assert._formatMessage(C,"Values in position "+B+" are not equivalent."),D[B],E[B]);}}},isEmpty:function(B,A){YUITest.Assert._increment();if(B.length>0){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Array should be empty."));}},isNotEmpty:function(B,A){YUITest.Assert._increment();if(B.length===0){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Array should not be empty."));}},itemsAreSame:function(C,D,B){YUITest.Assert._increment();if(C.length!=D.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Array should have a length of "+C.length+" but has a length of "+D.length));}for(var A=0;A<C.length;A++){if(C[A]!==D[A]){throw new YUITest.Assert.ComparisonFailure(YUITest.Assert._formatMessage(B,"Values in position "+A+" are not the same."),C[A],D[A]);}}},lastIndexOf:function(E,D,A,C){for(var B=D.length;B>=0;B--){if(D[B]===E){if(A!=B){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value exists at index "+B+" but should be at index "+A+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value doesn't exist in array."));}};YUITest.ObjectAssert={areEqual:function(C,D,B){YUITest.Assert._increment();for(var A in C){if(C.hasOwnProperty(A)){if(C[A]!=D[A]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(B,"Values should be equal for property "+A),C[A],D[A]);}}}},hasKey:function(A,B,C){YUITest.ObjectAssert.ownsOrInheritsKey(A,B,C);},hasKeys:function(B,A,C){YUITest.ObjectAssert.ownsOrInheritsKeys(B,objects,C);},inheritsKey:function(A,B,C){YUITest.Assert._increment();if(!(A in B&&!B.hasOwnProperty(A))){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object instance."));}},inheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(propertyName in A&&!A.hasOwnProperty(C[B]))){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));
-}}},ownsKey:function(A,B,C){YUITest.Assert._increment();if(!B.hasOwnProperty(A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object instance."));}},ownsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!A.hasOwnProperty(C[B])){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));}}},ownsNoKeys:function(B,D){YUITest.Assert._increment();var C=0,A;for(A in B){if(B.hasOwnProperty(A)){C++;}}if(C!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Object owns "+C+" properties but should own none."));}},ownsOrInheritsKey:function(A,B,C){YUITest.Assert._increment();if(!(A in B)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object."));}},ownsOrInheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(C[B] in A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getFullYear()!=D.getFullYear()){C="Years should be equal.";}if(B.getMonth()!=D.getMonth()){C="Months should be equal.";}if(B.getDate()!=D.getDate()){C="Days of month should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getHours()!=D.getHours()){C="Hours should be equal.";}if(B.getMinutes()!=D.getMinutes()){C="Minutes should be equal.";}if(B.getSeconds()!=D.getSeconds()){C="Seconds should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(D){D=D||{};var A,B;try{function E(){}E.prototype=D;A=new E();}catch(C){A={};}for(B in D){if(D.hasOwnProperty(B)){if(typeof D[B]=="function"){A[B]=function(F){return function(){YUITest.Assert.fail("Method "+F+"() was called but was not expected to be.");};}(B);}}}return A;};YUITest.Mock.expect=function(F,B){if(!F.__expectations){F.__expectations={};}if(B.method){var A=B.method,G=B.args||[],I=B.returns,E=(typeof B.callCount=="number")?B.callCount:1,H=B.error,C=B.run||function(){},D;F.__expectations[A]=B;B.callCount=E;B.actualCallCount=0;for(D=0;D<G.length;D++){if(!(G[D] instanceof YUITest.Mock.Value)){G[D]=YUITest.Mock.Value(YUITest.Assert.areSame,[G[D]],"Argument "+D+" of "+A+"() is incorrect.");}}if(E>0){F[A]=function(){try{B.actualCallCount++;YUITest.Assert.areEqual(G.length,arguments.length,"Method "+A+"() passed incorrect number of arguments.");for(var L=0,J=G.length;L<J;L++){G[L].verify(arguments[L]);}C.apply(this,arguments);if(H){throw H;}}catch(K){YUITest.TestRunner._handleError(K);}return I;};}else{F[A]=function(){try{YUITest.Assert.fail("Method "+A+"() should not have been called.");}catch(J){YUITest.TestRunner._handleError(J);}};}}else{if(B.property){F.__expectations[A]=B;}}};YUITest.Mock.verify=function(A){try{for(var C in A.__expectations){if(A.__expectations.hasOwnProperty(C)){var B=A.__expectations[C];if(B.method){YUITest.Assert.areEqual(B.callCount,B.actualCallCount,"Method "+B.method+"() wasn't called the expected number of times.");}else{if(B.property){YUITest.Assert.areEqual(B.value,A[B.property],"Property "+B.property+" wasn't set to the correct value.");}}}}}catch(D){YUITest.TestRunner._handleError(D);}};YUITest.Mock.Value=function(C,A,B){if(this instanceof YUITest.Mock.Value){this.verify=function(E){var D=[].concat(A||[]);D.push(E);D.push(B);C.apply(null,D);};}else{return new YUITest.Mock.Value(C,A,B);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(A){this.name=A;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(A){this.passed+=A.passed;this.failed+=A.failed;this.ignored+=A.ignored;this.total+=A.total;this.errors+=A.errors;};YUITest.TestCase=function(A){this._should={};for(var B in A){this[B]=A[B];}if(typeof this.name!="string"){this.name="testCase"+(+new Date());}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);},resume:function(A){YUITest.TestRunner.resume(A);},wait:function(B,A){A=(typeof A=="number"?A:10000);if(typeof B=="function"){throw new YUITest.Wait(B,A);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},A);}},assert:function(B,A){YUITest.Assert._increment();if(!B){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(A,"Assertion failed."));}},fail:function(A){YUITest.Assert.fail(A);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(A){this.name="";this.items=[];if(typeof A=="string"){this.name=A;}else{if(A instanceof Object){for(var B in A){if(A.hasOwnProperty(B)){this[B]=A[B];}}}}if(this.name===""){this.name="testSuite"+(+new Date());}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(A){if(A instanceof YUITest.TestSuite||A instanceof YUITest.TestCase){this.items.push(A);}return this;},setUp:function(){},tearDown:function(){}};YUITest.TestFormat=function(){function A(B){return B.replace(/[<>"'&]/g,function(C){switch(C){case"<":return"&lt;";
+}}},ownsKey:function(A,B,C){YUITest.Assert._increment();if(!B.hasOwnProperty(A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object instance."));}},ownsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!A.hasOwnProperty(C[B])){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));}}},ownsNoKeys:function(B,D){YUITest.Assert._increment();var C=0,A;for(A in B){if(B.hasOwnProperty(A)){C++;}}if(C!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Object owns "+C+" properties but should own none."));}},ownsOrInheritsKey:function(A,B,C){YUITest.Assert._increment();if(!(A in B)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object."));}},ownsOrInheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(C[B] in A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getFullYear()!=D.getFullYear()){C="Years should be equal.";}if(B.getMonth()!=D.getMonth()){C="Months should be equal.";}if(B.getDate()!=D.getDate()){C="Days of month should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getHours()!=D.getHours()){C="Hours should be equal.";}if(B.getMinutes()!=D.getMinutes()){C="Minutes should be equal.";}if(B.getSeconds()!=D.getSeconds()){C="Seconds should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(D){D=D||{};var A,B;try{function E(){}E.prototype=D;A=new E();}catch(C){A={};}for(B in D){if(D.hasOwnProperty(B)){if(typeof D[B]=="function"){A[B]=function(F){return function(){YUITest.Assert.fail("Method "+F+"() was called but was not expected to be.");};}(B);}}}return A;};YUITest.Mock.expect=function(F,B){if(!F.__expectations){F.__expectations={};}if(B.method){var A=B.method,G=B.args||[],I=B.returns,E=(typeof B.callCount=="number")?B.callCount:1,H=B.error,C=B.run||function(){},D;F.__expectations[A]=B;B.callCount=E;B.actualCallCount=0;for(D=0;D<G.length;D++){if(!(G[D] instanceof YUITest.Mock.Value)){G[D]=YUITest.Mock.Value(YUITest.Assert.areSame,[G[D]],"Argument "+D+" of "+A+"() is incorrect.");}}if(E>0){F[A]=function(){try{B.actualCallCount++;YUITest.Assert.areEqual(G.length,arguments.length,"Method "+A+"() passed incorrect number of arguments.");for(var L=0,J=G.length;L<J;L++){G[L].verify(arguments[L]);}C.apply(this,arguments);if(H){throw H;}}catch(K){YUITest.TestRunner._handleError(K);}return I;};}else{F[A]=function(){try{YUITest.Assert.fail("Method "+A+"() should not have been called.");}catch(J){YUITest.TestRunner._handleError(J);}};}}else{if(B.property){F.__expectations[A]=B;}}};YUITest.Mock.verify=function(A){try{for(var C in A.__expectations){if(A.__expectations.hasOwnProperty(C)){var B=A.__expectations[C];if(B.method){YUITest.Assert.areEqual(B.callCount,B.actualCallCount,"Method "+B.method+"() wasn't called the expected number of times.");}else{if(B.property){YUITest.Assert.areEqual(B.value,A[B.property],"Property "+B.property+" wasn't set to the correct value.");}}}}}catch(D){YUITest.TestRunner._handleError(D);}};YUITest.Mock.Value=function(C,A,B){if(this instanceof YUITest.Mock.Value){this.verify=function(E){var D=[].concat(A||[]);D.push(E);D.push(B);C.apply(null,D);};}else{return new YUITest.Mock.Value(C,A,B);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(A){this.name=A;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(A){this.passed+=A.passed;this.failed+=A.failed;this.ignored+=A.ignored;this.total+=A.total;this.errors+=A.errors;};YUITest.TestCase=function(A){this._should={};for(var B in A){this[B]=A[B];}if(typeof this.name!="string"){this.name="testCase"+(+new Date());}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);},resume:function(A){YUITest.TestRunner.resume(A);},wait:function(C,A){var B=(typeof C=="number"?C:A);B=(typeof B=="number"?B:10000);if(typeof C=="function"){throw new YUITest.Wait(C,B);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},B);}},assert:function(B,A){YUITest.Assert._increment();if(!B){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(A,"Assertion failed."));}},fail:function(A){YUITest.Assert.fail(A);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(A){this.name="";this.items=[];if(typeof A=="string"){this.name=A;}else{if(A instanceof Object){for(var B in A){if(A.hasOwnProperty(B)){this[B]=A[B];}}}}if(this.name===""){this.name="testSuite"+(+new Date());}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(A){if(A instanceof YUITest.TestSuite||A instanceof YUITest.TestCase){this.items.push(A);}return this;},setUp:function(){},tearDown:function(){}};YUITest.TestFormat=function(){function A(B){return B.replace(/[<>"'&]/g,function(C){switch(C){case"<":return"&lt;";
case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;";}});}return{JSON:function(B){return YUITest.Util.JSON.stringify(B);},XML:function(C){function B(E){var D="<"+E.type+' name="'+A(E.name)+'"';if(typeof(E.duration)=="number"){D+=' duration="'+E.duration+'"';}if(E.type=="test"){D+=' result="'+E.result+'" message="'+A(E.message)+'">';}else{D+=' passed="'+E.passed+'" failed="'+E.failed+'" ignored="'+E.ignored+'" total="'+E.total+'">';for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=B(E[F]);}}}}D+="</"+E.type+">";return D;}return'<?xml version="1.0" encoding="UTF-8"?>'+B(C);},JUnitXML:function(B){function C(E){var D="";switch(E.type){case"test":if(E.result!="ignore"){D='<testcase name="'+A(E.name)+'" time="'+(E.duration/1000)+'">';if(E.result=="fail"){D+='<failure message="'+A(E.message)+'"><![CDATA['+E.message+"]]></failure>";}D+="</testcase>";}break;case"testcase":D='<testsuite name="'+A(E.name)+'" tests="'+E.total+'" failures="'+E.failed+'" time="'+(E.duration/1000)+'">';for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=C(E[F]);}}}D+="</testsuite>";break;case"testsuite":for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=C(E[F]);}}}break;case"report":D="<testsuites>";for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=C(E[F]);}}}D+="</testsuites>";}return D;}return'<?xml version="1.0" encoding="UTF-8"?>'+C(B);},TAP:function(C){var D=1;function B(E){var F="";switch(E.type){case"test":if(E.result!="ignore"){F="ok "+(D++)+" - "+E.name;if(E.result=="fail"){F="not "+F+" - "+E.message;}F+="\n";}else{F="#Ignored test "+E.name+"\n";}break;case"testcase":F="#Begin testcase "+E.name+"("+E.failed+" failed of "+E.total+")\n";for(var G in E){if(E.hasOwnProperty(G)){if(E[G]&&typeof E[G]=="object"&&!(E[G] instanceof Array)){F+=B(E[G]);}}}F+="#End testcase "+E.name+"\n";break;case"testsuite":F="#Begin testsuite "+E.name+"("+E.failed+" failed of "+E.total+")\n";for(var G in E){if(E.hasOwnProperty(G)){if(E[G]&&typeof E[G]=="object"&&!(E[G] instanceof Array)){F+=B(E[G]);}}}F+="#End testsuite "+E.name+"\n";break;case"report":for(var G in E){if(E.hasOwnProperty(G)){if(E[G]&&typeof E[G]=="object"&&!(E[G] instanceof Array)){F+=B(E[G]);}}}}return F;}return"1.."+C.total+"\n"+B(C);}};}();YUITest.CoverageFormat={JSON:function(A){return YUITest.Util.JSON.stringify(A);},XdebugJSON:function(B){var A={};for(var C in B){if(B.hasOwnProperty(C)){A[C]=B[C].lines;}}return YUITest.Util.JSON.stringify(B);}};YUITest.TestRunner=function(){function C(E,G){if(!G.length){return true;}else{if(E){for(var F=0,D=E.length;F<D;F++){if(G.indexOf(","+E[F]+",")>-1){return true;}}}return false;}}function B(D){this.testObject=D;this.firstChild=null;this.lastChild=null;this.parent=null;this.next=null;this.results=new YUITest.Results();if(D instanceof YUITest.TestSuite){this.results.type="testsuite";this.results.name=D.name;}else{if(D instanceof YUITest.TestCase){this.results.type="testcase";this.results.name=D.name;}}}B.prototype={appendChild:function(D){var E=new B(D);if(this.firstChild===null){this.firstChild=this.lastChild=E;}else{this.lastChild.next=E;this.lastChild=E;}E.parent=this;return E;}};function A(){YUITest.EventTarget.call(this);this.masterSuite=new YUITest.TestSuite("yuitests"+(new Date()).getTime());this._cur=null;this._root=null;this._log=true;this._waiting=false;this._running=false;this._lastResults=null;this._context=null;this._groups="";}A.prototype=YUITest.Util.mix(new YUITest.EventTarget(),{constructor:YUITest.TestRunner,TEST_CASE_BEGIN_EVENT:"testcasebegin",TEST_CASE_COMPLETE_EVENT:"testcasecomplete",TEST_SUITE_BEGIN_EVENT:"testsuitebegin",TEST_SUITE_COMPLETE_EVENT:"testsuitecomplete",TEST_PASS_EVENT:"pass",TEST_FAIL_EVENT:"fail",ERROR_EVENT:"error",TEST_IGNORE_EVENT:"ignore",COMPLETE_EVENT:"complete",BEGIN_EVENT:"begin",_addTestCaseToTestTree:function(E,F){var G=E.appendChild(F),H,D;for(H in F){if((H.indexOf("test")===0||H.indexOf(" ")>-1)&&typeof F[H]=="function"){G.appendChild(H);}}},_addTestSuiteToTestTree:function(D,G){var F=D.appendChild(G);for(var E=0;E<G.items.length;E++){if(G.items[E] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(F,G.items[E]);}else{if(G.items[E] instanceof YUITest.TestCase){this._addTestCaseToTestTree(F,G.items[E]);}}}},_buildTestTree:function(){this._root=new B(this.masterSuite);for(var D=0;D<this.masterSuite.items.length;D++){if(this.masterSuite.items[D] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(this._root,this.masterSuite.items[D]);}else{if(this.masterSuite.items[D] instanceof YUITest.TestCase){this._addTestCaseToTestTree(this._root,this.masterSuite.items[D]);}}}},_handleTestObjectComplete:function(E){var D;if(typeof E.testObject=="object"&&E!==null){D=E.parent;if(D){D.results.include(E.results);D.results[E.testObject.name]=E.results;}if(E.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(E,"tearDown",false);E.results.duration=(new Date())-E._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:E.testObject,results:E.results});}else{if(E.testObject instanceof YUITest.TestCase){this._execNonTestMethod(E,"destroy",false);E.results.duration=(new Date())-E._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:E.testObject,results:E.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;
this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{this._cur=this._cur.next;}}}}return this._cur;},_execNonTestMethod:function(H,D,I){var E=H.testObject,G={type:this.ERROR_EVENT};try{if(I&&E["async:"+D]){E["async:"+D](this._context);return true;}else{E[D](this._context);}}catch(F){H.results.errors++;G.error=F;G.methodName=D;if(E instanceof YUITest.TestCase){G.testCase=E;}else{G.testSuite=testSuite;}this.fire(G);}return false;},_run:function(){var F=false;var E=this._next();if(E!==null){this._running=true;this._lastResult=null;var D=E.testObject;if(typeof D=="object"&&D!==null){if(D instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:D});E._start=new Date();this._execNonTestMethod(E,"setUp",false);}else{if(D instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:D});E._start=new Date();if(this._execNonTestMethod(E,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(E);}}},_resumeTest:function(I){var D=this._cur;this._waiting=false;if(!D){return;}var J=D.testObject;var G=D.parent.testObject;if(G.__yui_wait){clearTimeout(G.__yui_wait);delete G.__yui_wait;}var M=J.indexOf("fail:")===0||(G._should.fail||{})[J];var E=(G._should.error||{})[J];var H=false;var K=null;try{I.call(G,this._context);if(YUITest.Assert._getCount()==0){throw new YUITest.AssertionError("Test has no asserts.");}else{if(M){K=new YUITest.ShouldFail();H=true;}else{if(E){K=new YUITest.ShouldError();H=true;}}}}catch(L){if(G.__yui_wait){clearTimeout(G.__yui_wait);delete G.__yui_wait;}if(L instanceof YUITest.AssertionError){if(!M){K=L;H=true;}}else{if(L instanceof YUITest.Wait){if(typeof L.segment=="function"){if(typeof L.delay=="number"){if(typeof setTimeout!="undefined"){G.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(L.segment);},L.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!E){K=new YUITest.UnexpectedError(L);H=true;}else{if(typeof E=="string"){if(L.message!=E){K=new YUITest.UnexpectedError(L);H=true;}}else{if(typeof E=="function"){if(!(L instanceof E)){K=new YUITest.UnexpectedError(L);H=true;}}else{if(typeof E=="object"&&E!==null){if(!(L instanceof E.constructor)||L.message!=E.message){K=new YUITest.UnexpectedError(L);H=true;}}}}}}}}if(H){this.fire({type:this.TEST_FAIL_EVENT,testCase:G,testName:J,error:K});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:G,testName:J});}this._execNonTestMethod(D.parent,"tearDown",false);YUITest.Assert._reset();var F=(new Date())-D._start;D.parent.results[J]={result:H?"fail":"pass",message:K?K.getMessage():"Test passed",type:"test",name:J,duration:F};if(H){D.parent.results.failed++;}else{D.parent.results.passed++;}D.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(D){if(this._waiting){this._resumeTest(function(){throw D;});}else{throw D;}},_runTest:function(G){var D=G.testObject,E=G.parent.testObject,H=E[D],F=D.indexOf("ignore:")===0||!C(E.groups,this._groups)||(E._should.ignore||{})[D];if(F){G.parent.results[D]={result:"ignore",message:"Test ignored",type:"test",name:D.indexOf("ignore:")===0?D.substring(7):D};G.parent.results.ignored++;G.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:E,testName:D});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{G._start=new Date();this._execNonTestMethod(G.parent,"setUp",false);this._resumeTest(H);}},getName:function(){return this.masterSuite.name;},setName:function(D){this.masterSuite.name=D;},add:function(D){this.masterSuite.add(D);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite("yuitests"+(new Date()).getTime());},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(D){if(!this._running&&this._lastResults){if(typeof D=="function"){return D(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(D){if(!this._running&&typeof _yuitest_coverage=="object"){if(typeof D=="function"){return D(_yuitest_coverage);}else{return _yuitest_coverage;}}else{return null;}},callback:function(){var F=arguments,E=this._context,D=this;return function(){for(var G=0;G<arguments.length;G++){E[F[G]]=arguments[G];}D._run();};},resume:function(D){if(this._waiting){this._resumeTest(D||function(){});}else{throw new Error("resume() called without wait().");}},run:function(E){E=E||{};var F=YUITest.TestRunner,D=E.oldMode;if(!D&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];}F._groups=(E.groups instanceof Array)?","+E.groups.join(",")+",":"";F._buildTestTree();F._context={};F._root._start=new Date();F.fire(F.BEGIN_EVENT);F._run();}});return new A();}();
View
11 javascript/build/yuitest/yuitest-core.js
@@ -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);
}
},
View
11 javascript/build/yuitest/yuitest-debug.js
@@ -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);
}
},
View
2  javascript/build/yuitest/yuitest-min.js
@@ -1,6 +1,6 @@
var YUITest={version:"@VERSION@"};YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(A,B){if(typeof this._handlers[A]=="undefined"){this._handlers[A]=[];}this._handlers[A].push(B);},subscribe:function(A,B){this.attach.apply(this,arguments);},fire:function(D){if(typeof D=="string"){D={type:D};}if(!D.target){D.target=this;}if(!D.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[D.type] instanceof Array){var B=this._handlers[D.type];for(var C=0,A=B.length;C<A;C++){B[C].call(this,D);}}},detach:function(D,E){if(this._handlers[D] instanceof Array){var B=this._handlers[D];for(var C=0,A=B.length;C<A;C++){if(B[C]===E){B.splice(C,1);break;}}}},unsubscribe:function(A,B){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(B,A){for(var C in A){if(A.hasOwnProperty(C)){B[C]=A[C];}}return B;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.AssertionError=function(A){this.message=A;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(B,A,C){YUITest.AssertionError.call(this,B);this.expected=A;this.actual=C;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(A){YUITest.AssertionError.call(this,A||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(A){YUITest.AssertionError.call(this,A||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(A){YUITest.AssertionError.call(this,"Unexpected error: "+A.message);this.cause=A;this.name="UnexpectedError";this.stack=A.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(B,A){YUITest.AssertionError.call(this,B);this.unexpected=A;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(B,A){this.segment=(typeof B=="function"?B:null);this.delay=(typeof A=="number"?A:0);};YUITest.Assert={_asserts:0,_formatMessage:function(B,A){if(typeof B=="string"&&B.length>0){return B.replace("{message}",A);}else{return A;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(A){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(A,"Test force-failed."));},areEqual:function(B,C,A){YUITest.Assert._increment();if(B!=C){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Values should be equal."),B,C);}},areNotEqual:function(A,C,B){YUITest.Assert._increment();if(A==C){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(B,"Values should not be equal."),A);}},areNotSame:function(A,C,B){YUITest.Assert._increment();if(A===C){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(B,"Values should not be the same."),A);}},areSame:function(B,C,A){YUITest.Assert._increment();if(B!==C){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Values should be the same."),B,C);}},isFalse:function(B,A){YUITest.Assert._increment();if(false!==B){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be false."),false,B);}},isTrue:function(B,A){YUITest.Assert._increment();if(true!==B){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be true."),true,B);}},isNaN:function(B,A){YUITest.Assert._increment();if(!isNaN(B)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be NaN."),NaN,B);}},isNotNaN:function(B,A){YUITest.Assert._increment();if(isNaN(B)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Values should not be NaN."),NaN);}},isNotNull:function(B,A){YUITest.Assert._increment();if(B===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Values should not be null."),null);}},isNotUndefined:function(B,A){YUITest.Assert._increment();if(typeof B=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should not be undefined."),undefined);}},isNull:function(B,A){YUITest.Assert._increment();if(B!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be null."),null,B);}},isUndefined:function(B,A){YUITest.Assert._increment();if(typeof B!="undefined"){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be undefined."),undefined,B);}},isArray:function(C,B){YUITest.Assert._increment();var A=false;if(Array.isArray){A=!Array.isArray(C);}else{A=Object.prototype.toString.call(C)!="[object Array]";}if(A){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(B,"Value should be an array."),C);}},isBoolean:function(B,A){YUITest.Assert._increment();if(typeof B!="boolean"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a Boolean."),B);}},isFunction:function(B,A){YUITest.Assert._increment();if(!(B instanceof Function)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a function."),B);
}},isInstanceOf:function(B,C,A){YUITest.Assert._increment();if(!(C instanceof B)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value isn't an instance of expected type."),B,C);}},isNumber:function(B,A){YUITest.Assert._increment();if(typeof B!="number"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a number."),B);}},isObject:function(B,A){YUITest.Assert._increment();if(!B||(typeof B!="object"&&typeof B!="function")){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be an object."),B);}},isString:function(B,A){YUITest.Assert._increment();if(typeof B!="string"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a string."),B);}},isTypeOf:function(A,C,B){YUITest.Assert._increment();if(typeof C!=A){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(B,"Value should be of type "+A+"."),A,typeof C);}},throwsError:function(D,E,C){YUITest.Assert._increment();var A=false;try{E();}catch(B){if(typeof D=="string"){if(B.message!=D){A=true;}}else{if(typeof D=="function"){if(!(B instanceof D)){A=true;}}else{if(typeof D=="object"&&D!==null){if(!(B instanceof D.constructor)||B.message!=D.message){A=true;}}else{A=true;}}}if(A){throw new YUITest.UnexpectedError(B);}else{return;}}throw new YUITest.AssertionError(YUITest.Assert._formatMessage(C,"Error should have been thrown."));}};YUITest.ArrayAssert={_indexOf:function(B,C){if(B.indexOf){return B.indexOf(C);}else{for(var A=0;A<B.length;A++){if(B[A]===C){return A;}}return -1;}},_some:function(B,C){if(B.some){return B.some(C);}else{for(var A=0;A<B.length;A++){if(C(B[A])){return true;}}return false;}},contains:function(C,B,A){YUITest.Assert._increment();if(this._indexOf(B,C)==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Value "+C+" ("+(typeof C)+") not found in array ["+B+"]."));}},containsItems:function(C,D,B){YUITest.Assert._increment();for(var A=0;A<C.length;A++){if(this._indexOf(D,C[A])==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Value "+C[A]+" ("+(typeof C[A])+") not found in array ["+D+"]."));}}},containsMatch:function(C,B,A){YUITest.Assert._increment();if(typeof C!="function"){throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");}if(!this._some(B,C)){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"No match found in array ["+B+"]."));}},doesNotContain:function(C,B,A){YUITest.Assert._increment();if(this._indexOf(B,C)>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Value found in array ["+B+"]."));}},doesNotContainItems:function(C,D,B){YUITest.Assert._increment();for(var A=0;A<C.length;A++){if(this._indexOf(D,C[A])>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Value found in array ["+D+"]."));}}},doesNotContainMatch:function(C,B,A){YUITest.Assert._increment();if(typeof C!="function"){throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");}if(this._some(B,C)){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Value found in array ["+B+"]."));}},indexOf:function(E,D,A,C){YUITest.Assert._increment();for(var B=0;B<D.length;B++){if(D[B]===E){if(A!=B){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value exists at index "+B+" but should be at index "+A+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value doesn't exist in array ["+D+"]."));},itemsAreEqual:function(C,D,B){YUITest.Assert._increment();if(C.length!=D.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Array should have a length of "+C.length+" but has a length of "+D.length));}for(var A=0;A<C.length;A++){if(C[A]!=D[A]){throw new YUITest.Assert.ComparisonFailure(YUITest.Assert._formatMessage(B,"Values in position "+A+" are not equal."),C[A],D[A]);}}},itemsAreEquivalent:function(D,E,A,C){YUITest.Assert._increment();if(typeof A!="function"){throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");}if(D.length!=E.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Array should have a length of "+D.length+" but has a length of "+E.length));}for(var B=0;B<D.length;B++){if(!A(D[B],E[B])){throw new YUITest.Assert.ComparisonFailure(YUITest.Assert._formatMessage(C,"Values in position "+B+" are not equivalent."),D[B],E[B]);}}},isEmpty:function(B,A){YUITest.Assert._increment();if(B.length>0){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Array should be empty."));}},isNotEmpty:function(B,A){YUITest.Assert._increment();if(B.length===0){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Array should not be empty."));}},itemsAreSame:function(C,D,B){YUITest.Assert._increment();if(C.length!=D.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Array should have a length of "+C.length+" but has a length of "+D.length));}for(var A=0;A<C.length;A++){if(C[A]!==D[A]){throw new YUITest.Assert.ComparisonFailure(YUITest.Assert._formatMessage(B,"Values in position "+A+" are not the same."),C[A],D[A]);}}},lastIndexOf:function(E,D,A,C){for(var B=D.length;B>=0;B--){if(D[B]===E){if(A!=B){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value exists at index "+B+" but should be at index "+A+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value doesn't exist in array."));}};YUITest.ObjectAssert={areEqual:function(C,D,B){YUITest.Assert._increment();for(var A in C){if(C.hasOwnProperty(A)){if(C[A]!=D[A]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(B,"Values should be equal for property "+A),C[A],D[A]);}}}},hasKey:function(A,B,C){YUITest.ObjectAssert.ownsOrInheritsKey(A,B,C);},hasKeys:function(B,A,C){YUITest.ObjectAssert.ownsOrInheritsKeys(B,objects,C);},inheritsKey:function(A,B,C){YUITest.Assert._increment();if(!(A in B&&!B.hasOwnProperty(A))){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object instance."));}},inheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(propertyName in A&&!A.hasOwnProperty(C[B]))){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));
-}}},ownsKey:function(A,B,C){YUITest.Assert._increment();if(!B.hasOwnProperty(A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object instance."));}},ownsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!A.hasOwnProperty(C[B])){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));}}},ownsNoKeys:function(B,D){YUITest.Assert._increment();var C=0,A;for(A in B){if(B.hasOwnProperty(A)){C++;}}if(C!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Object owns "+C+" properties but should own none."));}},ownsOrInheritsKey:function(A,B,C){YUITest.Assert._increment();if(!(A in B)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object."));}},ownsOrInheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(C[B] in A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getFullYear()!=D.getFullYear()){C="Years should be equal.";}if(B.getMonth()!=D.getMonth()){C="Months should be equal.";}if(B.getDate()!=D.getDate()){C="Days of month should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getHours()!=D.getHours()){C="Hours should be equal.";}if(B.getMinutes()!=D.getMinutes()){C="Minutes should be equal.";}if(B.getSeconds()!=D.getSeconds()){C="Seconds should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(D){D=D||{};var A,B;try{function E(){}E.prototype=D;A=new E();}catch(C){A={};}for(B in D){if(D.hasOwnProperty(B)){if(typeof D[B]=="function"){A[B]=function(F){return function(){YUITest.Assert.fail("Method "+F+"() was called but was not expected to be.");};}(B);}}}return A;};YUITest.Mock.expect=function(F,B){if(!F.__expectations){F.__expectations={};}if(B.method){var A=B.method,G=B.args||[],I=B.returns,E=(typeof B.callCount=="number")?B.callCount:1,H=B.error,C=B.run||function(){},D;F.__expectations[A]=B;B.callCount=E;B.actualCallCount=0;for(D=0;D<G.length;D++){if(!(G[D] instanceof YUITest.Mock.Value)){G[D]=YUITest.Mock.Value(YUITest.Assert.areSame,[G[D]],"Argument "+D+" of "+A+"() is incorrect.");}}if(E>0){F[A]=function(){try{B.actualCallCount++;YUITest.Assert.areEqual(G.length,arguments.length,"Method "+A+"() passed incorrect number of arguments.");for(var L=0,J=G.length;L<J;L++){G[L].verify(arguments[L]);}C.apply(this,arguments);if(H){throw H;}}catch(K){YUITest.TestRunner._handleError(K);}return I;};}else{F[A]=function(){try{YUITest.Assert.fail("Method "+A+"() should not have been called.");}catch(J){YUITest.TestRunner._handleError(J);}};}}else{if(B.property){F.__expectations[A]=B;}}};YUITest.Mock.verify=function(A){try{for(var C in A.__expectations){if(A.__expectations.hasOwnProperty(C)){var B=A.__expectations[C];if(B.method){YUITest.Assert.areEqual(B.callCount,B.actualCallCount,"Method "+B.method+"() wasn't called the expected number of times.");}else{if(B.property){YUITest.Assert.areEqual(B.value,A[B.property],"Property "+B.property+" wasn't set to the correct value.");}}}}}catch(D){YUITest.TestRunner._handleError(D);}};YUITest.Mock.Value=function(C,A,B){if(this instanceof YUITest.Mock.Value){this.verify=function(E){var D=[].concat(A||[]);D.push(E);D.push(B);C.apply(null,D);};}else{return new YUITest.Mock.Value(C,A,B);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(A){this.name=A;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(A){this.passed+=A.passed;this.failed+=A.failed;this.ignored+=A.ignored;this.total+=A.total;this.errors+=A.errors;};YUITest.TestCase=function(A){this._should={};for(var B in A){this[B]=A[B];}if(typeof this.name!="string"){this.name="testCase"+(+new Date());}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);},resume:function(A){YUITest.TestRunner.resume(A);},wait:function(B,A){A=(typeof A=="number"?A:10000);if(typeof B=="function"){throw new YUITest.Wait(B,A);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},A);}},assert:function(B,A){YUITest.Assert._increment();if(!B){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(A,"Assertion failed."));}},fail:function(A){YUITest.Assert.fail(A);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(A){this.name="";this.items=[];if(typeof A=="string"){this.name=A;}else{if(A instanceof Object){for(var B in A){if(A.hasOwnProperty(B)){this[B]=A[B];}}}}if(this.name===""){this.name="testSuite"+(+new Date());}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(A){if(A instanceof YUITest.TestSuite||A instanceof YUITest.TestCase){this.items.push(A);}return this;},setUp:function(){},tearDown:function(){}};YUITest.TestFormat=function(){function A(B){return B.replace(/[<>"'&]/g,function(C){switch(C){case"<":return"&lt;";
+}}},ownsKey:function(A,B,C){YUITest.Assert._increment();if(!B.hasOwnProperty(A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object instance."));}},ownsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!A.hasOwnProperty(C[B])){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));}}},ownsNoKeys:function(B,D){YUITest.Assert._increment();var C=0,A;for(A in B){if(B.hasOwnProperty(A)){C++;}}if(C!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Object owns "+C+" properties but should own none."));}},ownsOrInheritsKey:function(A,B,C){YUITest.Assert._increment();if(!(A in B)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object."));}},ownsOrInheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(C[B] in A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getFullYear()!=D.getFullYear()){C="Years should be equal.";}if(B.getMonth()!=D.getMonth()){C="Months should be equal.";}if(B.getDate()!=D.getDate()){C="Days of month should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getHours()!=D.getHours()){C="Hours should be equal.";}if(B.getMinutes()!=D.getMinutes()){C="Minutes should be equal.";}if(B.getSeconds()!=D.getSeconds()){C="Seconds should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(D){D=D||{};var A,B;try{function E(){}E.prototype=D;A=new E();}catch(C){A={};}for(B in D){if(D.hasOwnProperty(B)){if(typeof D[B]=="function"){A[B]=function(F){return function(){YUITest.Assert.fail("Method "+F+"() was called but was not expected to be.");};}(B);}}}return A;};YUITest.Mock.expect=function(F,B){if(!F.__expectations){F.__expectations={};}if(B.method){var A=B.method,G=B.args||[],I=B.returns,E=(typeof B.callCount=="number")?B.callCount:1,H=B.error,C=B.run||function(){},D;F.__expectations[A]=B;B.callCount=E;B.actualCallCount=0;for(D=0;D<G.length;D++){if(!(G[D] instanceof YUITest.Mock.Value)){G[D]=YUITest.Mock.Value(YUITest.Assert.areSame,[G[D]],"Argument "+D+" of "+A+"() is incorrect.");}}if(E>0){F[A]=function(){try{B.actualCallCount++;YUITest.Assert.areEqual(G.length,arguments.length,"Method "+A+"() passed incorrect number of arguments.");for(var L=0,J=G.length;L<J;L++){G[L].verify(arguments[L]);}C.apply(this,arguments);if(H){throw H;}}catch(K){YUITest.TestRunner._handleError(K);}return I;};}else{F[A]=function(){try{YUITest.Assert.fail("Method "+A+"() should not have been called.");}catch(J){YUITest.TestRunner._handleError(J);}};}}else{if(B.property){F.__expectations[A]=B;}}};YUITest.Mock.verify=function(A){try{for(var C in A.__expectations){if(A.__expectations.hasOwnProperty(C)){var B=A.__expectations[C];if(B.method){YUITest.Assert.areEqual(B.callCount,B.actualCallCount,"Method "+B.method+"() wasn't called the expected number of times.");}else{if(B.property){YUITest.Assert.areEqual(B.value,A[B.property],"Property "+B.property+" wasn't set to the correct value.");}}}}}catch(D){YUITest.TestRunner._handleError(D);}};YUITest.Mock.Value=function(C,A,B){if(this instanceof YUITest.Mock.Value){this.verify=function(E){var D=[].concat(A||[]);D.push(E);D.push(B);C.apply(null,D);};}else{return new YUITest.Mock.Value(C,A,B);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(A){this.name=A;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(A){this.passed+=A.passed;this.failed+=A.failed;this.ignored+=A.ignored;this.total+=A.total;this.errors+=A.errors;};YUITest.TestCase=function(A){this._should={};for(var B in A){this[B]=A[B];}if(typeof this.name!="string"){this.name="testCase"+(+new Date());}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);},resume:function(A){YUITest.TestRunner.resume(A);},wait:function(C,A){var B=(typeof C=="number"?C:A);B=(typeof B=="number"?B:10000);if(typeof C=="function"){throw new YUITest.Wait(C,B);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},B);}},assert:function(B,A){YUITest.Assert._increment();if(!B){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(A,"Assertion failed."));}},fail:function(A){YUITest.Assert.fail(A);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(A){this.name="";this.items=[];if(typeof A=="string"){this.name=A;}else{if(A instanceof Object){for(var B in A){if(A.hasOwnProperty(B)){this[B]=A[B];}}}}if(this.name===""){this.name="testSuite"+(+new Date());}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(A){if(A instanceof YUITest.TestSuite||A instanceof YUITest.TestCase){this.items.push(A);}return this;},setUp:function(){},tearDown:function(){}};YUITest.TestFormat=function(){function A(B){return B.replace(/[<>"'&]/g,function(C){switch(C){case"<":return"&lt;";
case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;";}});}return{JSON:function(B){return YUITest.Util.JSON.stringify(B);},XML:function(C){function B(E){var D="<"+E.type+' name="'+A(E.name)+'"';if(typeof(E.duration)=="number"){D+=' duration="'+E.duration+'"';}if(E.type=="test"){D+=' result="'+E.result+'" message="'+A(E.message)+'">';}else{D+=' passed="'+E.passed+'" failed="'+E.failed+'" ignored="'+E.ignored+'" total="'+E.total+'">';for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=B(E[F]);}}}}D+="</"+E.type+">";return D;}return'<?xml version="1.0" encoding="UTF-8"?>'+B(C);},JUnitXML:function(B){function C(E){var D="";switch(E.type){case"test":if(E.result!="ignore"){D='<testcase name="'+A(E.name)+'" time="'+(E.duration/1000)+'">';if(E.result=="fail"){D+='<failure message="'+A(E.message)+'"><![CDATA['+E.message+"]]></failure>";}D+="</testcase>";}break;case"testcase":D='<testsuite name="'+A(E.name)+'" tests="'+E.total+'" failures="'+E.failed+'" time="'+(E.duration/1000)+'">';for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=C(E[F]);}}}D+="</testsuite>";break;case"testsuite":for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=C(E[F]);}}}break;case"report":D="<testsuites>";for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=C(E[F]);}}}D+="</testsuites>";}return D;}return'<?xml version="1.0" encoding="UTF-8"?>'+C(B);},TAP:function(C){var D=1;function B(E){var F="";switch(E.type){case"test":if(E.result!="ignore"){F="ok "+(D++)+" - "+E.name;if(E.result=="fail"){F="not "+F+" - "+E.message;}F+="\n";}else{F="#Ignored test "+E.name+"\n";}break;case"testcase":F="#Begin testcase "+E.name+"("+E.failed+" failed of "+E.total+")\n";for(var G in E){if(E.hasOwnProperty(G)){if(E[G]&&typeof E[G]=="object"&&!(E[G] instanceof Array)){F+=B(E[G]);}}}F+="#End testcase "+E.name+"\n";break;case"testsuite":F="#Begin testsuite "+E.name+"("+E.failed+" failed of "+E.total+")\n";for(var G in E){if(E.hasOwnProperty(G)){if(E[G]&&typeof E[G]=="object"&&!(E[G] instanceof Array)){F+=B(E[G]);}}}F+="#End testsuite "+E.name+"\n";break;case"report":for(var G in E){if(E.hasOwnProperty(G)){if(E[G]&&typeof E[G]=="object"&&!(E[G] instanceof Array)){F+=B(E[G]);}}}}return F;}return"1.."+C.total+"\n"+B(C);}};}();YUITest.CoverageFormat={JSON:function(A){return YUITest.Util.JSON.stringify(A);},XdebugJSON:function(B){var A={};for(var C in B){if(B.hasOwnProperty(C)){A[C]=B[C].lines;}}return YUITest.Util.JSON.stringify(B);}};YUITest.Event=(function(){var I={click:1,dblclick:1,mouseover:1,mouseout:1,mousedown:1,mouseup:1,mousemove:1},H={keydown:1,keyup:1,keypress:1},C={blur:1,change:1,focus:1,resize:1,scroll:1,select:1},D={scroll:1,resize:1,reset:1,submit:1,change:1,select:1,error:1,abort:1,click:1,dblclick:1,mouseover:1,mouseout:1,mousedown:1,mouseup:1,mousemove:1,keydown:1,keyup:1,keypress:1},E,B;function G(O,S,N,L,U,K,J,T,Q,W,V){if(!O){throw new Error("simulateKeyEvent(): Invalid target.");}if(typeof S=="string"){S=S.toLowerCase();switch(S){case"textevent":S="keypress";break;case"keyup":case"keydown":case"keypress":break;default:throw new Error("simulateKeyEvent(): Event type '"+S+"' not supported.");}}else{throw new Error("simulateKeyEvent(): Event type must be a string.");}if(typeof N!="boolean"){N=true;}if(typeof L!="boolean"){L=true;}if(typeof U!="object"||U==null){U=window;}if(typeof K!="boolean"){K=false;}if(typeof J!="boolean"){J=false;}if(typeof T!="boolean"){T=false;}if(typeof Q!="boolean"){Q=false;}if(typeof W!="number"){W=0;}if(typeof V!="number"){V=0;}var R=null;if(typeof document.createEvent=="function"){try{R=document.createEvent("KeyEvents");R.initKeyEvent(S,N,L,U,K,J,T,Q,W,V);}catch(P){try{R=document.createEvent("Events");}catch(M){R=document.createEvent("UIEvents");}finally{R.initEvent(S,N,L);R.view=U;R.altKey=J;R.ctrlKey=K;R.shiftKey=T;R.metaKey=Q;R.keyCode=W;R.charCode=V;}}O.dispatchEvent(R);}else{if(typeof document.createEventObject!="undefined"){R=document.createEventObject();R.bubbles=N;R.cancelable=L;R.view=U;R.ctrlKey=K;R.altKey=J;R.shiftKey=T;R.metaKey=Q;R.keyCode=(V>0)?V:W;O.fireEvent("on"+S,R);}else{throw new Error("simulateKeyEvent(): No event simulation framework present.");}}}function A(T,Y,Q,N,Z,S,P,O,M,K,L,J,X,V,R,U){if(!T){throw new Error("simulateMouseEvent(): Invalid target.");}if(typeof Y=="string"){Y=Y.toLowerCase();if(!I[Y]){throw new Error("simulateMouseEvent(): Event type '"+Y+"' not supported.");}}else{throw new Error("simulateMouseEvent(): Event type must be a string.");}if(typeof Q!="boolean"){Q=true;}if(typeof N!="boolean"){N=(Y!="mousemove");}if(typeof Z!="object"||Z!=null){Z=window;}if(typeof S!="number"){S=1;}if(typeof P!="number"){P=0;}if(typeof O!="number"){O=0;}if(typeof M!="number"){M=0;}if(typeof K!="number"){K=0;}if(typeof L!="boolean"){L=false;}if(typeof J!="boolean"){J=false;}if(typeof X!="boolean"){X=false;}if(typeof V!="boolean"){V=false;}if(typeof R!="number"){R=0;}if(!U){U=null;}var W=null;if(typeof document.createEvent=="function"){W=document.createEvent("MouseEvents");if(W.initMouseEvent){W.initMouseEvent(Y,Q,N,Z,S,P,O,M,K,L,J,X,V,R,U);}else{W=document.createEvent("UIEvents");W.initEvent(Y,Q,N);W.view=Z;W.detail=S;W.screenX=P;W.screenY=O;W.clientX=M;W.clientY=K;W.ctrlKey=L;W.altKey=J;W.metaKey=V;W.shiftKey=X;W.button=R;W.relatedTarget=U;}if(U&&!W.relatedTarget){if(Y=="mouseout"){W.toElement=U;}else{if(Y=="mouseover"){W.fromElement=U;}}}T.dispatchEvent(W);}else{if(typeof document.createEventObject!="undefined"){W=document.createEventObject();W.bubbles=Q;W.cancelable=N;W.view=Z;W.detail=S;W.screenX=P;W.screenY=O;W.clientX=M;W.clientY=K;W.ctrlKey=L;W.altKey=J;W.metaKey=V;W.shiftKey=X;switch(R){case 0:W.button=1;break;case 1:W.button=4;break;case 2:break;default:W.button=0;}W.relatedTarget=U;T.fireEvent("on"+Y,W);}else{throw new Error("simulateMouseEvent(): No event simulation framework present.");
}}}function F(P,O,L,K,J,N){if(!P){throw new Error("simulateUIEvent(): Invalid target.");}if(typeof O=="string"){O=O.toLowerCase();if(!C[O]){throw new Error("simulateUIEvent(): Event type '"+O+"' not supported.");}}else{throw new Error("simulateUIEvent(): Event type must be a string.");}var M=null;if(typeof L!="boolean"){L=(O in D);}if(typeof K!="boolean"){K=(O=="submit");}if(typeof J!="object"||J!=null){J=window;}if(typeof N!="number"){N=1;}if(typeof document.createEvent=="function"){M=document.createEvent("UIEvents");M.initUIEvent(O,L,K,J,N);P.dispatchEvent(M);}else{if(typeof document.createEventObject!="undefined"){M=document.createEventObject();M.bubbles=L;M.cancelable=K;M.view=J;M.detail=N;P.fireEvent("on"+O,M);}else{throw new Error("simulateUIEvent(): No event simulation framework present.");}}}E={simulate:function(L,K,J){J=J||{};if(I[K]){A(L,K,J.bubbles,J.cancelable,J.view,J.detail,J.screenX,J.screenY,J.clientX,J.clientY,J.ctrlKey,J.altKey,J.shiftKey,J.metaKey,J.button,J.relatedTarget);}else{if(H[K]){G(L,K,J.bubbles,J.cancelable,J.view,J.ctrlKey,J.altKey,J.shiftKey,J.metaKey,J.keyCode,J.charCode);}else{if(C[K]){F(L,K,J.bubbles,J.cancelable,J.view,J.detail);}else{throw new Error("simulate(): Event '"+K+"' can't be simulated.");}}}}};for(B in I){if(I.hasOwnProperty(B)){E[B]=(function(J){return function(L,K){K=K||{};A(L,J,K.bubbles,K.cancelable,K.view,K.detail,K.screenX,K.screenY,K.clientX,K.clientY,K.ctrlKey,K.altKey,K.shiftKey,K.metaKey,K.button,K.relatedTarget);};})(B);}}for(B in H){if(H.hasOwnProperty(B)){E[B]=(function(J){return function(L,K){K=K||{};G(L,J,K.bubbles,K.cancelable,K.view,K.ctrlKey,K.altKey,K.shiftKey,K.metaKey,K.keyCode,K.charCode);};})(B);}}for(B in C){if(C.hasOwnProperty(B)){E[B]=(function(J){return function(L,K){K=K||{};F(L,J,K.bubbles,K.cancelable,K.view,K.detail);};})(B);}}return E;})();YUITest.Reporter=function(A,B){this.url=A;this.format=B||YUITest.TestFormat.XML;this._fields=new Object();this._form=null;this._iframe=null;};YUITest.Reporter.prototype={constructor:YUITest.Reporter,addField:function(A,B){this._fields[A]=B;},clearFields:function(){this._fields=new Object();},destroy:function(){if(this._form){this._form.parentNode.removeChild(this._form);this._form=null;}if(this._iframe){this._iframe.parentNode.removeChild(this._iframe);this._iframe=null;}this._fields=null;},report:function(C){if(!this._form){this._form=document.createElement("form");this._form.method="post";this._form.style.visibility="hidden";this._form.style.position="absolute";this._form.style.top=0;document.body.appendChild(this._form);try{this._iframe=document.createElement('<iframe name="yuiTestTarget" />');}catch(B){this._iframe=document.createElement("iframe");this._iframe.name="yuiTestTarget";}this._iframe.src="javascript:false";this._iframe.style.visibility="hidden";this._iframe.style.position="absolute";this._iframe.style.top=0;document.body.appendChild(this._iframe);this._form.target="yuiTestTarget";}this._form.action=this.url;while(this._form.hasChildNodes()){this._form.removeChild(this._form.lastChild);}this._fields.results=this.format(C);this._fields.useragent=navigator.userAgent;this._fields.timestamp=(new Date()).toLocaleString();for(var E in this._fields){var D=this._fields[E];if(this._fields.hasOwnProperty(E)&&(typeof D!="function")){var A=document.createElement("input");A.type="hidden";A.name=E;A.value=D;this._form.appendChild(A);}}delete this._fields.results;delete this._fields.useragent;delete this._fields.timestamp;if(arguments[1]!==false){this._form.submit();}}};YUITest.PageManager=YUITest.Util.mix(new YUITest.EventTarget(),{TEST_PAGE_BEGIN_EVENT:"testpagebegin",TEST_PAGE_COMPLETE_EVENT:"testpagecomplete",TEST_MANAGER_BEGIN_EVENT:"testmanagerbegin",TEST_MANAGER_COMPLETE_EVENT:"testmanagercomplete",_curPage:null,_frame:null,_timeoutId:0,_pages:[],_results:null,_handleTestRunnerComplete:function(A){this.fire(this.TEST_PAGE_COMPLETE_EVENT,{page:this._curPage,results:A.results});this._processResults(this._curPage,A.results);if(this._pages.length){this._timeoutId=setTimeout(function(){YUITest.TestManager._run();},1000);}else{this.fire(this.TEST_MANAGER_COMPLETE_EVENT,this._results);}},_processResults:function(C,A){var B=this._results;B.passed+=A.passed;B.failed+=A.failed;B.ignored+=A.ignored;B.total+=A.total;B.duration+=A.duration;if(A.failed){B.failedPages.push(C);}else{B.passedPages.push(C);}A.name=C;A.type="page";B[C]=A;},_run:function(){this._curPage=this._pages.shift();this.fire(this.TEST_PAGE_BEGIN_EVENT,this._curPage);this._frame.location.replace(this._curPage);},load:function(){if(parent.YUITest.PageManager!==this){parent.YUITest.PageManager.load();}else{if(this._frame){var A=this._frame.YUITest.TestRunner;A.subscribe(A.COMPLETE_EVENT,this._handleTestRunnerComplete,this,true);A.run();}}},setPages:function(A){this._pages=A;},start:function(){if(!this._initialized){if(!this._frame){var A=document.createElement("iframe");A.style.visibility="hidden";A.style.position="absolute";document.body.appendChild(A);this._frame=A.contentWindow||A.contentDocument.parentWindow;}this._initialized=true;}this._results={passed:0,failed:0,ignored:0,total:0,type:"report",name:"YUI Test Results",duration:0,failedPages:[],passedPages:[]};this.fire(this.TEST_MANAGER_BEGIN_EVENT,null);this._run();},stop:function(){clearTimeout(this._timeoutId);}});YUITest.TestRunner=function(){function C(E,G){if(!G.length){return true;}else{if(E){for(var F=0,D=E.length;F<D;F++){if(G.indexOf(","+E[F]+",")>-1){return true;}}}return false;}}function B(D){this.testObject=D;this.firstChild=null;this.lastChild=null;this.parent=null;this.next=null;this.results=new YUITest.Results();if(D instanceof YUITest.TestSuite){this.results.type="testsuite";this.results.name=D.name;}else{if(D instanceof YUITest.TestCase){this.results.type="testcase";this.results.name=D.name;}}}B.prototype={appendChild:function(D){var E=new B(D);if(this.firstChild===null){this.firstChild=this.lastChild=E;}else{this.lastChild.next=E;this.lastChild=E;
}E.parent=this;return E;}};function A(){YUITest.EventTarget.call(this);this.masterSuite=new YUITest.TestSuite("yuitests"+(new Date()).getTime());this._cur=null;this._root=null;this._log=true;this._waiting=false;this._running=false;this._lastResults=null;this._context=null;this._groups="";}A.prototype=YUITest.Util.mix(new YUITest.EventTarget(),{constructor:YUITest.TestRunner,TEST_CASE_BEGIN_EVENT:"testcasebegin",TEST_CASE_COMPLETE_EVENT:"testcasecomplete",TEST_SUITE_BEGIN_EVENT:"testsuitebegin",TEST_SUITE_COMPLETE_EVENT:"testsuitecomplete",TEST_PASS_EVENT:"pass",TEST_FAIL_EVENT:"fail",ERROR_EVENT:"error",TEST_IGNORE_EVENT:"ignore",COMPLETE_EVENT:"complete",BEGIN_EVENT:"begin",_addTestCaseToTestTree:function(E,F){var G=E.appendChild(F),H,D;for(H in F){if((H.indexOf("test")===0||H.indexOf(" ")>-1)&&typeof F[H]=="function"){G.appendChild(H);}}},_addTestSuiteToTestTree:function(D,G){var F=D.appendChild(G);for(var E=0;E<G.items.length;E++){if(G.items[E] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(F,G.items[E]);}else{if(G.items[E] instanceof YUITest.TestCase){this._addTestCaseToTestTree(F,G.items[E]);}}}},_buildTestTree:function(){this._root=new B(this.masterSuite);for(var D=0;D<this.masterSuite.items.length;D++){if(this.masterSuite.items[D] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(this._root,this.masterSuite.items[D]);}else{if(this.masterSuite.items[D] instanceof YUITest.TestCase){this._addTestCaseToTestTree(this._root,this.masterSuite.items[D]);}}}},_handleTestObjectComplete:function(E){var D;if(typeof E.testObject=="object"&&E!==null){D=E.parent;if(D){D.results.include(E.results);D.results[E.testObject.name]=E.results;}if(E.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(E,"tearDown",false);E.results.duration=(new Date())-E._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:E.testObject,results:E.results});}else{if(E.testObject instanceof YUITest.TestCase){this._execNonTestMethod(E,"destroy",false);E.results.duration=(new Date())-E._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:E.testObject,results:E.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{this._cur=this._cur.next;}}}}return this._cur;},_execNonTestMethod:function(H,D,I){var E=H.testObject,G={type:this.ERROR_EVENT};try{if(I&&E["async:"+D]){E["async:"+D](this._context);return true;}else{E[D](this._context);}}catch(F){H.results.errors++;G.error=F;G.methodName=D;if(E instanceof YUITest.TestCase){G.testCase=E;}else{G.testSuite=testSuite;}this.fire(G);}return false;},_run:function(){var F=false;var E=this._next();if(E!==null){this._running=true;this._lastResult=null;var D=E.testObject;if(typeof D=="object"&&D!==null){if(D instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:D});E._start=new Date();this._execNonTestMethod(E,"setUp",false);}else{if(D instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:D});E._start=new Date();if(this._execNonTestMethod(E,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(E);}}},_resumeTest:function(I){var D=this._cur;this._waiting=false;if(!D){return;}var J=D.testObject;var G=D.parent.testObject;if(G.__yui_wait){clearTimeout(G.__yui_wait);delete G.__yui_wait;}var M=J.indexOf("fail:")===0||(G._should.fail||{})[J];var E=(G._should.error||{})[J];var H=false;var K=null;try{I.call(G,this._context);if(YUITest.Assert._getCount()==0){throw new YUITest.AssertionError("Test has no asserts.");}else{if(M){K=new YUITest.ShouldFail();H=true;}else{if(E){K=new YUITest.ShouldError();H=true;}}}}catch(L){if(G.__yui_wait){clearTimeout(G.__yui_wait);delete G.__yui_wait;}if(L instanceof YUITest.AssertionError){if(!M){K=L;H=true;}}else{if(L instanceof YUITest.Wait){if(typeof L.segment=="function"){if(typeof L.delay=="number"){if(typeof setTimeout!="undefined"){G.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(L.segment);},L.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!E){K=new YUITest.UnexpectedError(L);H=true;}else{if(typeof E=="string"){if(L.message!=E){K=new YUITest.UnexpectedError(L);H=true;}}else{if(typeof E=="function"){if(!(L instanceof E)){K=new YUITest.UnexpectedError(L);H=true;}}else{if(typeof E=="object"&&E!==null){if(!(L instanceof E.constructor)||L.message!=E.message){K=new YUITest.UnexpectedError(L);H=true;}}}}}}}}if(H){this.fire({type:this.TEST_FAIL_EVENT,testCase:G,testName:J,error:K});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:G,testName:J});}this._execNonTestMethod(D.parent,"tearDown",false);YUITest.Assert._reset();var F=(new Date())-D._start;D.parent.results[J]={result:H?"fail":"pass",message:K?K.getMessage():"Test passed",type:"test",name:J,duration:F};if(H){D.parent.results.failed++;}else{D.parent.results.passed++;}D.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(D){if(this._waiting){this._resumeTest(function(){throw D;});}else{throw D;}},_runTest:function(G){var D=G.testObject,E=G.parent.testObject,H=E[D],F=D.indexOf("ignore:")===0||!C(E.groups,this._groups)||(E._should.ignore||{})[D];if(F){G.parent.results[D]={result:"ignore",message:"Test ignored",type:"test",name:D.indexOf("ignore:")===0?D.substring(7):D};
View
11 javascript/build/yuitest/yuitest-node-debug.js
@@ -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);
}
},
View
2  javascript/build/yuitest/yuitest-node-min.js
@@ -1,6 +1,6 @@
var YUITest=exports;YUITest.version="@VERSION@";exports.YUITest=YUITest;YUITest.EventTarget=function(){this._handlers={};};YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(A,B){if(typeof this._handlers[A]=="undefined"){this._handlers[A]=[];}this._handlers[A].push(B);},subscribe:function(A,B){this.attach.apply(this,arguments);},fire:function(D){if(typeof D=="string"){D={type:D};}if(!D.target){D.target=this;}if(!D.type){throw new Error("Event object missing 'type' property.");}if(this._handlers[D.type] instanceof Array){var B=this._handlers[D.type];for(var C=0,A=B.length;C<A;C++){B[C].call(this,D);}}},detach:function(D,E){if(this._handlers[D] instanceof Array){var B=this._handlers[D];for(var C=0,A=B.length;C<A;C++){if(B[C]===E){B.splice(C,1);break;}}}},unsubscribe:function(A,B){this.detach.apply(this,arguments);}};YUITest.Util={mix:function(B,A){for(var C in A){if(A.hasOwnProperty(C)){B[C]=A[C];}}return B;},JSON:typeof JSON!="undefined"?JSON:{stringify:function(){throw new Error("No JSON utility specified.");}}};YUITest.AssertionError=function(A){this.message=A;this.name="Assert Error";};YUITest.AssertionError.prototype={constructor:YUITest.AssertionError,getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}};YUITest.ComparisonFailure=function(B,A,C){YUITest.AssertionError.call(this,B);this.expected=A;this.actual=C;this.name="ComparisonFailure";};YUITest.ComparisonFailure.prototype=new YUITest.AssertionError;YUITest.ComparisonFailure.prototype.constructor=YUITest.ComparisonFailure;YUITest.ComparisonFailure.prototype.getMessage=function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual: "+this.actual+" ("+(typeof this.actual)+")";};YUITest.ShouldError=function(A){YUITest.AssertionError.call(this,A||"This test should have thrown an error but didn't.");this.name="ShouldError";};YUITest.ShouldError.prototype=new YUITest.AssertionError();YUITest.ShouldError.prototype.constructor=YUITest.ShouldError;YUITest.ShouldFail=function(A){YUITest.AssertionError.call(this,A||"This test should fail but didn't.");this.name="ShouldFail";};YUITest.ShouldFail.prototype=new YUITest.AssertionError();YUITest.ShouldFail.prototype.constructor=YUITest.ShouldFail;YUITest.UnexpectedError=function(A){YUITest.AssertionError.call(this,"Unexpected error: "+A.message);this.cause=A;this.name="UnexpectedError";this.stack=A.stack;};YUITest.UnexpectedError.prototype=new YUITest.AssertionError();YUITest.UnexpectedError.prototype.constructor=YUITest.UnexpectedError;YUITest.UnexpectedValue=function(B,A){YUITest.AssertionError.call(this,B);this.unexpected=A;this.name="UnexpectedValue";};YUITest.UnexpectedValue.prototype=new YUITest.AssertionError();YUITest.UnexpectedValue.prototype.constructor=YUITest.UnexpectedValue;YUITest.UnexpectedValue.prototype.getMessage=function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";};YUITest.Wait=function(B,A){this.segment=(typeof B=="function"?B:null);this.delay=(typeof A=="number"?A:0);};YUITest.Assert={_asserts:0,_formatMessage:function(B,A){if(typeof B=="string"&&B.length>0){return B.replace("{message}",A);}else{return A;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(A){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(A,"Test force-failed."));},areEqual:function(B,C,A){YUITest.Assert._increment();if(B!=C){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Values should be equal."),B,C);}},areNotEqual:function(A,C,B){YUITest.Assert._increment();if(A==C){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(B,"Values should not be equal."),A);}},areNotSame:function(A,C,B){YUITest.Assert._increment();if(A===C){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(B,"Values should not be the same."),A);}},areSame:function(B,C,A){YUITest.Assert._increment();if(B!==C){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Values should be the same."),B,C);}},isFalse:function(B,A){YUITest.Assert._increment();if(false!==B){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be false."),false,B);}},isTrue:function(B,A){YUITest.Assert._increment();if(true!==B){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be true."),true,B);}},isNaN:function(B,A){YUITest.Assert._increment();if(!isNaN(B)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be NaN."),NaN,B);}},isNotNaN:function(B,A){YUITest.Assert._increment();if(isNaN(B)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Values should not be NaN."),NaN);}},isNotNull:function(B,A){YUITest.Assert._increment();if(B===null){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Values should not be null."),null);}},isNotUndefined:function(B,A){YUITest.Assert._increment();if(typeof B=="undefined"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should not be undefined."),undefined);}},isNull:function(B,A){YUITest.Assert._increment();if(B!==null){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be null."),null,B);}},isUndefined:function(B,A){YUITest.Assert._increment();if(typeof B!="undefined"){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value should be undefined."),undefined,B);}},isArray:function(C,B){YUITest.Assert._increment();var A=false;if(Array.isArray){A=!Array.isArray(C);}else{A=Object.prototype.toString.call(C)!="[object Array]";}if(A){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(B,"Value should be an array."),C);}},isBoolean:function(B,A){YUITest.Assert._increment();if(typeof B!="boolean"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a Boolean."),B);}},isFunction:function(B,A){YUITest.Assert._increment();
if(!(B instanceof Function)){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a function."),B);}},isInstanceOf:function(B,C,A){YUITest.Assert._increment();if(!(C instanceof B)){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,"Value isn't an instance of expected type."),B,C);}},isNumber:function(B,A){YUITest.Assert._increment();if(typeof B!="number"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a number."),B);}},isObject:function(B,A){YUITest.Assert._increment();if(!B||(typeof B!="object"&&typeof B!="function")){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be an object."),B);}},isString:function(B,A){YUITest.Assert._increment();if(typeof B!="string"){throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(A,"Value should be a string."),B);}},isTypeOf:function(A,C,B){YUITest.Assert._increment();if(typeof C!=A){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(B,"Value should be of type "+A+"."),A,typeof C);}},throwsError:function(D,E,C){YUITest.Assert._increment();var A=false;try{E();}catch(B){if(typeof D=="string"){if(B.message!=D){A=true;}}else{if(typeof D=="function"){if(!(B instanceof D)){A=true;}}else{if(typeof D=="object"&&D!==null){if(!(B instanceof D.constructor)||B.message!=D.message){A=true;}}else{A=true;}}}if(A){throw new YUITest.UnexpectedError(B);}else{return;}}throw new YUITest.AssertionError(YUITest.Assert._formatMessage(C,"Error should have been thrown."));}};YUITest.ArrayAssert={_indexOf:function(B,C){if(B.indexOf){return B.indexOf(C);}else{for(var A=0;A<B.length;A++){if(B[A]===C){return A;}}return -1;}},_some:function(B,C){if(B.some){return B.some(C);}else{for(var A=0;A<B.length;A++){if(C(B[A])){return true;}}return false;}},contains:function(C,B,A){YUITest.Assert._increment();if(this._indexOf(B,C)==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Value "+C+" ("+(typeof C)+") not found in array ["+B+"]."));}},containsItems:function(C,D,B){YUITest.Assert._increment();for(var A=0;A<C.length;A++){if(this._indexOf(D,C[A])==-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Value "+C[A]+" ("+(typeof C[A])+") not found in array ["+D+"]."));}}},containsMatch:function(C,B,A){YUITest.Assert._increment();if(typeof C!="function"){throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");}if(!this._some(B,C)){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"No match found in array ["+B+"]."));}},doesNotContain:function(C,B,A){YUITest.Assert._increment();if(this._indexOf(B,C)>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Value found in array ["+B+"]."));}},doesNotContainItems:function(C,D,B){YUITest.Assert._increment();for(var A=0;A<C.length;A++){if(this._indexOf(D,C[A])>-1){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Value found in array ["+D+"]."));}}},doesNotContainMatch:function(C,B,A){YUITest.Assert._increment();if(typeof C!="function"){throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");}if(this._some(B,C)){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Value found in array ["+B+"]."));}},indexOf:function(E,D,A,C){YUITest.Assert._increment();for(var B=0;B<D.length;B++){if(D[B]===E){if(A!=B){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value exists at index "+B+" but should be at index "+A+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value doesn't exist in array ["+D+"]."));},itemsAreEqual:function(C,D,B){YUITest.Assert._increment();if(C.length!=D.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Array should have a length of "+C.length+" but has a length of "+D.length));}for(var A=0;A<C.length;A++){if(C[A]!=D[A]){throw new YUITest.Assert.ComparisonFailure(YUITest.Assert._formatMessage(B,"Values in position "+A+" are not equal."),C[A],D[A]);}}},itemsAreEquivalent:function(D,E,A,C){YUITest.Assert._increment();if(typeof A!="function"){throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");}if(D.length!=E.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Array should have a length of "+D.length+" but has a length of "+E.length));}for(var B=0;B<D.length;B++){if(!A(D[B],E[B])){throw new YUITest.Assert.ComparisonFailure(YUITest.Assert._formatMessage(C,"Values in position "+B+" are not equivalent."),D[B],E[B]);}}},isEmpty:function(B,A){YUITest.Assert._increment();if(B.length>0){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Array should be empty."));}},isNotEmpty:function(B,A){YUITest.Assert._increment();if(B.length===0){YUITest.Assert.fail(YUITest.Assert._formatMessage(A,"Array should not be empty."));}},itemsAreSame:function(C,D,B){YUITest.Assert._increment();if(C.length!=D.length){YUITest.Assert.fail(YUITest.Assert._formatMessage(B,"Array should have a length of "+C.length+" but has a length of "+D.length));}for(var A=0;A<C.length;A++){if(C[A]!==D[A]){throw new YUITest.Assert.ComparisonFailure(YUITest.Assert._formatMessage(B,"Values in position "+A+" are not the same."),C[A],D[A]);}}},lastIndexOf:function(E,D,A,C){for(var B=D.length;B>=0;B--){if(D[B]===E){if(A!=B){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value exists at index "+B+" but should be at index "+A+"."));}return;}}YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Value doesn't exist in array."));}};YUITest.ObjectAssert={areEqual:function(C,D,B){YUITest.Assert._increment();for(var A in C){if(C.hasOwnProperty(A)){if(C[A]!=D[A]){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(B,"Values should be equal for property "+A),C[A],D[A]);}}}},hasKey:function(A,B,C){YUITest.ObjectAssert.ownsOrInheritsKey(A,B,C);},hasKeys:function(B,A,C){YUITest.ObjectAssert.ownsOrInheritsKeys(B,objects,C);},inheritsKey:function(A,B,C){YUITest.Assert._increment();if(!(A in B&&!B.hasOwnProperty(A))){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object instance."));
-}},inheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(propertyName in A&&!A.hasOwnProperty(C[B]))){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));}}},ownsKey:function(A,B,C){YUITest.Assert._increment();if(!B.hasOwnProperty(A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object instance."));}},ownsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!A.hasOwnProperty(C[B])){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));}}},ownsNoKeys:function(B,D){YUITest.Assert._increment();var C=0,A;for(A in B){if(B.hasOwnProperty(A)){C++;}}if(C!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Object owns "+C+" properties but should own none."));}},ownsOrInheritsKey:function(A,B,C){YUITest.Assert._increment();if(!(A in B)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object."));}},ownsOrInheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(C[B] in A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getFullYear()!=D.getFullYear()){C="Years should be equal.";}if(B.getMonth()!=D.getMonth()){C="Months should be equal.";}if(B.getDate()!=D.getDate()){C="Days of month should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getHours()!=D.getHours()){C="Hours should be equal.";}if(B.getMinutes()!=D.getMinutes()){C="Minutes should be equal.";}if(B.getSeconds()!=D.getSeconds()){C="Seconds should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(D){D=D||{};var A,B;try{function E(){}E.prototype=D;A=new E();}catch(C){A={};}for(B in D){if(D.hasOwnProperty(B)){if(typeof D[B]=="function"){A[B]=function(F){return function(){YUITest.Assert.fail("Method "+F+"() was called but was not expected to be.");};}(B);}}}return A;};YUITest.Mock.expect=function(F,B){if(!F.__expectations){F.__expectations={};}if(B.method){var A=B.method,G=B.args||[],I=B.returns,E=(typeof B.callCount=="number")?B.callCount:1,H=B.error,C=B.run||function(){},D;F.__expectations[A]=B;B.callCount=E;B.actualCallCount=0;for(D=0;D<G.length;D++){if(!(G[D] instanceof YUITest.Mock.Value)){G[D]=YUITest.Mock.Value(YUITest.Assert.areSame,[G[D]],"Argument "+D+" of "+A+"() is incorrect.");}}if(E>0){F[A]=function(){try{B.actualCallCount++;YUITest.Assert.areEqual(G.length,arguments.length,"Method "+A+"() passed incorrect number of arguments.");for(var L=0,J=G.length;L<J;L++){G[L].verify(arguments[L]);}C.apply(this,arguments);if(H){throw H;}}catch(K){YUITest.TestRunner._handleError(K);}return I;};}else{F[A]=function(){try{YUITest.Assert.fail("Method "+A+"() should not have been called.");}catch(J){YUITest.TestRunner._handleError(J);}};}}else{if(B.property){F.__expectations[A]=B;}}};YUITest.Mock.verify=function(A){try{for(var C in A.__expectations){if(A.__expectations.hasOwnProperty(C)){var B=A.__expectations[C];if(B.method){YUITest.Assert.areEqual(B.callCount,B.actualCallCount,"Method "+B.method+"() wasn't called the expected number of times.");}else{if(B.property){YUITest.Assert.areEqual(B.value,A[B.property],"Property "+B.property+" wasn't set to the correct value.");}}}}}catch(D){YUITest.TestRunner._handleError(D);}};YUITest.Mock.Value=function(C,A,B){if(this instanceof YUITest.Mock.Value){this.verify=function(E){var D=[].concat(A||[]);D.push(E);D.push(B);C.apply(null,D);};}else{return new YUITest.Mock.Value(C,A,B);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(A){this.name=A;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(A){this.passed+=A.passed;this.failed+=A.failed;this.ignored+=A.ignored;this.total+=A.total;this.errors+=A.errors;};YUITest.TestCase=function(A){this._should={};for(var B in A){this[B]=A[B];}if(typeof this.name!="string"){this.name="testCase"+(+new Date());}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);},resume:function(A){YUITest.TestRunner.resume(A);},wait:function(B,A){A=(typeof A=="number"?A:10000);if(typeof B=="function"){throw new YUITest.Wait(B,A);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},A);}},assert:function(B,A){YUITest.Assert._increment();if(!B){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(A,"Assertion failed."));}},fail:function(A){YUITest.Assert.fail(A);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(A){this.name="";this.items=[];if(typeof A=="string"){this.name=A;}else{if(A instanceof Object){for(var B in A){if(A.hasOwnProperty(B)){this[B]=A[B];}}}}if(this.name===""){this.name="testSuite"+(+new Date());}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(A){if(A instanceof YUITest.TestSuite||A instanceof YUITest.TestCase){this.items.push(A);
+}},inheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(propertyName in A&&!A.hasOwnProperty(C[B]))){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));}}},ownsKey:function(A,B,C){YUITest.Assert._increment();if(!B.hasOwnProperty(A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object instance."));}},ownsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!A.hasOwnProperty(C[B])){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object instance."));}}},ownsNoKeys:function(B,D){YUITest.Assert._increment();var C=0,A;for(A in B){if(B.hasOwnProperty(A)){C++;}}if(C!==0){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Object owns "+C+" properties but should own none."));}},ownsOrInheritsKey:function(A,B,C){YUITest.Assert._increment();if(!(A in B)){YUITest.Assert.fail(YUITest.Assert._formatMessage(C,"Property '"+A+"' not found on object."));}},ownsOrInheritsKeys:function(C,A,D){YUITest.Assert._increment();for(var B=0;B<C.length;B++){if(!(C[B] in A)){YUITest.Assert.fail(YUITest.Assert._formatMessage(D,"Property '"+C[B]+"' not found on object."));}}}};YUITest.DateAssert={datesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getFullYear()!=D.getFullYear()){C="Years should be equal.";}if(B.getMonth()!=D.getMonth()){C="Months should be equal.";}if(B.getDate()!=D.getDate()){C="Days of month should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(B,D,A){YUITest.Assert._increment();if(B instanceof Date&&D instanceof Date){var C="";if(B.getHours()!=D.getHours()){C="Hours should be equal.";}if(B.getMinutes()!=D.getMinutes()){C="Minutes should be equal.";}if(B.getSeconds()!=D.getSeconds()){C="Seconds should be equal.";}if(C.length){throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(A,C),B,D);}}else{throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YUITest.Mock=function(D){D=D||{};var A,B;try{function E(){}E.prototype=D;A=new E();}catch(C){A={};}for(B in D){if(D.hasOwnProperty(B)){if(typeof D[B]=="function"){A[B]=function(F){return function(){YUITest.Assert.fail("Method "+F+"() was called but was not expected to be.");};}(B);}}}return A;};YUITest.Mock.expect=function(F,B){if(!F.__expectations){F.__expectations={};}if(B.method){var A=B.method,G=B.args||[],I=B.returns,E=(typeof B.callCount=="number")?B.callCount:1,H=B.error,C=B.run||function(){},D;F.__expectations[A]=B;B.callCount=E;B.actualCallCount=0;for(D=0;D<G.length;D++){if(!(G[D] instanceof YUITest.Mock.Value)){G[D]=YUITest.Mock.Value(YUITest.Assert.areSame,[G[D]],"Argument "+D+" of "+A+"() is incorrect.");}}if(E>0){F[A]=function(){try{B.actualCallCount++;YUITest.Assert.areEqual(G.length,arguments.length,"Method "+A+"() passed incorrect number of arguments.");for(var L=0,J=G.length;L<J;L++){G[L].verify(arguments[L]);}C.apply(this,arguments);if(H){throw H;}}catch(K){YUITest.TestRunner._handleError(K);}return I;};}else{F[A]=function(){try{YUITest.Assert.fail("Method "+A+"() should not have been called.");}catch(J){YUITest.TestRunner._handleError(J);}};}}else{if(B.property){F.__expectations[A]=B;}}};YUITest.Mock.verify=function(A){try{for(var C in A.__expectations){if(A.__expectations.hasOwnProperty(C)){var B=A.__expectations[C];if(B.method){YUITest.Assert.areEqual(B.callCount,B.actualCallCount,"Method "+B.method+"() wasn't called the expected number of times.");}else{if(B.property){YUITest.Assert.areEqual(B.value,A[B.property],"Property "+B.property+" wasn't set to the correct value.");}}}}}catch(D){YUITest.TestRunner._handleError(D);}};YUITest.Mock.Value=function(C,A,B){if(this instanceof YUITest.Mock.Value){this.verify=function(E){var D=[].concat(A||[]);D.push(E);D.push(B);C.apply(null,D);};}else{return new YUITest.Mock.Value(C,A,B);}};YUITest.Mock.Value.Any=YUITest.Mock.Value(function(){});YUITest.Mock.Value.Boolean=YUITest.Mock.Value(YUITest.Assert.isBoolean);YUITest.Mock.Value.Number=YUITest.Mock.Value(YUITest.Assert.isNumber);YUITest.Mock.Value.String=YUITest.Mock.Value(YUITest.Assert.isString);YUITest.Mock.Value.Object=YUITest.Mock.Value(YUITest.Assert.isObject);YUITest.Mock.Value.Function=YUITest.Mock.Value(YUITest.Assert.isFunction);YUITest.Results=function(A){this.name=A;this.passed=0;this.failed=0;this.errors=0;this.ignored=0;this.total=0;this.duration=0;};YUITest.Results.prototype.include=function(A){this.passed+=A.passed;this.failed+=A.failed;this.ignored+=A.ignored;this.total+=A.total;this.errors+=A.errors;};YUITest.TestCase=function(A){this._should={};for(var B in A){this[B]=A[B];}if(typeof this.name!="string"){this.name="testCase"+(+new Date());}};YUITest.TestCase.prototype={constructor:YUITest.TestCase,callback:function(){return YUITest.TestRunner.callback.apply(YUITest.TestRunner,arguments);},resume:function(A){YUITest.TestRunner.resume(A);},wait:function(C,A){var B=(typeof C=="number"?C:A);B=(typeof B=="number"?B:10000);if(typeof C=="function"){throw new YUITest.Wait(C,B);}else{throw new YUITest.Wait(function(){YUITest.Assert.fail("Timeout: wait() called but resume() never called.");},B);}},assert:function(B,A){YUITest.Assert._increment();if(!B){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(A,"Assertion failed."));}},fail:function(A){YUITest.Assert.fail(A);},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}};YUITest.TestSuite=function(A){this.name="";this.items=[];if(typeof A=="string"){this.name=A;}else{if(A instanceof Object){for(var B in A){if(A.hasOwnProperty(B)){this[B]=A[B];}}}}if(this.name===""){this.name="testSuite"+(+new Date());}};YUITest.TestSuite.prototype={constructor:YUITest.TestSuite,add:function(A){if(A instanceof YUITest.TestSuite||A instanceof YUITest.TestCase){this.items.push(A);
}return this;},setUp:function(){},tearDown:function(){}};YUITest.TestFormat=function(){function A(B){return B.replace(/[<>"'&]/g,function(C){switch(C){case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;";}});}return{JSON:function(B){return YUITest.Util.JSON.stringify(B);},XML:function(C){function B(E){var D="<"+E.type+' name="'+A(E.name)+'"';if(typeof(E.duration)=="number"){D+=' duration="'+E.duration+'"';}if(E.type=="test"){D+=' result="'+E.result+'" message="'+A(E.message)+'">';}else{D+=' passed="'+E.passed+'" failed="'+E.failed+'" ignored="'+E.ignored+'" total="'+E.total+'">';for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=B(E[F]);}}}}D+="</"+E.type+">";return D;}return'<?xml version="1.0" encoding="UTF-8"?>'+B(C);},JUnitXML:function(B){function C(E){var D="";switch(E.type){case"test":if(E.result!="ignore"){D='<testcase name="'+A(E.name)+'" time="'+(E.duration/1000)+'">';if(E.result=="fail"){D+='<failure message="'+A(E.message)+'"><![CDATA['+E.message+"]]></failure>";}D+="</testcase>";}break;case"testcase":D='<testsuite name="'+A(E.name)+'" tests="'+E.total+'" failures="'+E.failed+'" time="'+(E.duration/1000)+'">';for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=C(E[F]);}}}D+="</testsuite>";break;case"testsuite":for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=C(E[F]);}}}break;case"report":D="<testsuites>";for(var F in E){if(E.hasOwnProperty(F)){if(E[F]&&typeof E[F]=="object"&&!(E[F] instanceof Array)){D+=C(E[F]);}}}D+="</testsuites>";}return D;}return'<?xml version="1.0" encoding="UTF-8"?>'+C(B);},TAP:function(C){var D=1;function B(E){var F="";switch(E.type){case"test":if(E.result!="ignore"){F="ok "+(D++)+" - "+E.name;if(E.result=="fail"){F="not "+F+" - "+E.message;}F+="\n";}else{F="#Ignored test "+E.name+"\n";}break;case"testcase":F="#Begin testcase "+E.name+"("+E.failed+" failed of "+E.total+")\n";for(var G in E){if(E.hasOwnProperty(G)){if(E[G]&&typeof E[G]=="object"&&!(E[G] instanceof Array)){F+=B(E[G]);}}}F+="#End testcase "+E.name+"\n";break;case"testsuite":F="#Begin testsuite "+E.name+"("+E.failed+" failed of "+E.total+")\n";for(var G in E){if(E.hasOwnProperty(G)){if(E[G]&&typeof E[G]=="object"&&!(E[G] instanceof Array)){F+=B(E[G]);}}}F+="#End testsuite "+E.name+"\n";break;case"report":for(var G in E){if(E.hasOwnProperty(G)){if(E[G]&&typeof E[G]=="object"&&!(E[G] instanceof Array)){F+=B(E[G]);}}}}return F;}return"1.."+C.total+"\n"+B(C);}};}();YUITest.CoverageFormat={JSON:function(A){return YUITest.Util.JSON.stringify(A);},XdebugJSON:function(B){var A={};for(var C in B){if(B.hasOwnProperty(C)){A[C]=B[C].lines;}}return YUITest.Util.JSON.stringify(B);}};YUITest.TestRunner=function(){function C(E,G){if(!G.length){return true;}else{if(E){for(var F=0,D=E.length;F<D;F++){if(G.indexOf(","+E[F]+",")>-1){return true;}}}return false;}}function B(D){this.testObject=D;this.firstChild=null;this.lastChild=null;this.parent=null;this.next=null;this.results=new YUITest.Results();if(D instanceof YUITest.TestSuite){this.results.type="testsuite";this.results.name=D.name;}else{if(D instanceof YUITest.TestCase){this.results.type="testcase";this.results.name=D.name;}}}B.prototype={appendChild:function(D){var E=new B(D);if(this.firstChild===null){this.firstChild=this.lastChild=E;}else{this.lastChild.next=E;this.lastChild=E;}E.parent=this;return E;}};function A(){YUITest.EventTarget.call(this);this.masterSuite=new YUITest.TestSuite("yuitests"+(new Date()).getTime());this._cur=null;this._root=null;this._log=true;this._waiting=false;this._running=false;this._lastResults=null;this._context=null;this._groups="";}A.prototype=YUITest.Util.mix(new YUITest.EventTarget(),{constructor:YUITest.TestRunner,TEST_CASE_BEGIN_EVENT:"testcasebegin",TEST_CASE_COMPLETE_EVENT:"testcasecomplete",TEST_SUITE_BEGIN_EVENT:"testsuitebegin",TEST_SUITE_COMPLETE_EVENT:"testsuitecomplete",TEST_PASS_EVENT:"pass",TEST_FAIL_EVENT:"fail",ERROR_EVENT:"error",TEST_IGNORE_EVENT:"ignore",COMPLETE_EVENT:"complete",BEGIN_EVENT:"begin",_addTestCaseToTestTree:function(E,F){var G=E.appendChild(F),H,D;for(H in F){if((H.indexOf("test")===0||H.indexOf(" ")>-1)&&typeof F[H]=="function"){G.appendChild(H);}}},_addTestSuiteToTestTree:function(D,G){var F=D.appendChild(G);for(var E=0;E<G.items.length;E++){if(G.items[E] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(F,G.items[E]);}else{if(G.items[E] instanceof YUITest.TestCase){this._addTestCaseToTestTree(F,G.items[E]);}}}},_buildTestTree:function(){this._root=new B(this.masterSuite);for(var D=0;D<this.masterSuite.items.length;D++){if(this.masterSuite.items[D] instanceof YUITest.TestSuite){this._addTestSuiteToTestTree(this._root,this.masterSuite.items[D]);}else{if(this.masterSuite.items[D] instanceof YUITest.TestCase){this._addTestCaseToTestTree(this._root,this.masterSuite.items[D]);}}}},_handleTestObjectComplete:function(E){var D;if(typeof E.testObject=="object"&&E!==null){D=E.parent;if(D){D.results.include(E.results);D.results[E.testObject.name]=E.results;}if(E.testObject instanceof YUITest.TestSuite){this._execNonTestMethod(E,"tearDown",false);E.results.duration=(new Date())-E._start;this.fire({type:this.TEST_SUITE_COMPLETE_EVENT,testSuite:E.testObject,results:E.results});}else{if(E.testObject instanceof YUITest.TestCase){this._execNonTestMethod(E,"destroy",false);E.results.duration=(new Date())-E._start;this.fire({type:this.TEST_CASE_COMPLETE_EVENT,testCase:E.testObject,results:E.results});}}}},_next:function(){if(this._cur===null){this._cur=this._root;}else{if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}this._handleTestObjectComplete(this._cur);if(this._cur==this._root){this._cur.results.type="report";
this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur._start;this._lastResults=this._cur.results;this._running=false;this.fire({type:this.COMPLETE_EVENT,results:this._lastResults});this._cur=null;}else{this._cur=this._cur.next;}}}}return this._cur;},_execNonTestMethod:function(H,D,I){var E=H.testObject,G={type:this.ERROR_EVENT};try{if(I&&E["async:"+D]){E["async:"+D](this._context);return true;}else{E[D](this._context);}}catch(F){H.results.errors++;G.error=F;G.methodName=D;if(E instanceof YUITest.TestCase){G.testCase=E;}else{G.testSuite=testSuite;}this.fire(G);}return false;},_run:function(){var F=false;var E=this._next();if(E!==null){this._running=true;this._lastResult=null;var D=E.testObject;if(typeof D=="object"&&D!==null){if(D instanceof YUITest.TestSuite){this.fire({type:this.TEST_SUITE_BEGIN_EVENT,testSuite:D});E._start=new Date();this._execNonTestMethod(E,"setUp",false);}else{if(D instanceof YUITest.TestCase){this.fire({type:this.TEST_CASE_BEGIN_EVENT,testCase:D});E._start=new Date();if(this._execNonTestMethod(E,"init",true)){return;}}}if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{this._runTest(E);}}},_resumeTest:function(I){var D=this._cur;this._waiting=false;if(!D){return;}var J=D.testObject;var G=D.parent.testObject;if(G.__yui_wait){clearTimeout(G.__yui_wait);delete G.__yui_wait;}var M=J.indexOf("fail:")===0||(G._should.fail||{})[J];var E=(G._should.error||{})[J];var H=false;var K=null;try{I.call(G,this._context);if(YUITest.Assert._getCount()==0){throw new YUITest.AssertionError("Test has no asserts.");}else{if(M){K=new YUITest.ShouldFail();H=true;}else{if(E){K=new YUITest.ShouldError();H=true;}}}}catch(L){if(G.__yui_wait){clearTimeout(G.__yui_wait);delete G.__yui_wait;}if(L instanceof YUITest.AssertionError){if(!M){K=L;H=true;}}else{if(L instanceof YUITest.Wait){if(typeof L.segment=="function"){if(typeof L.delay=="number"){if(typeof setTimeout!="undefined"){G.__yui_wait=setTimeout(function(){YUITest.TestRunner._resumeTest(L.segment);},L.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!E){K=new YUITest.UnexpectedError(L);H=true;}else{if(typeof E=="string"){if(L.message!=E){K=new YUITest.UnexpectedError(L);H=true;}}else{if(typeof E=="function"){if(!(L instanceof E)){K=new YUITest.UnexpectedError(L);H=true;}}else{if(typeof E=="object"&&E!==null){if(!(L instanceof E.constructor)||L.message!=E.message){K=new YUITest.UnexpectedError(L);H=true;}}}}}}}}if(H){this.fire({type:this.TEST_FAIL_EVENT,testCase:G,testName:J,error:K});}else{this.fire({type:this.TEST_PASS_EVENT,testCase:G,testName:J});}this._execNonTestMethod(D.parent,"tearDown",false);YUITest.Assert._reset();var F=(new Date())-D._start;D.parent.results[J]={result:H?"fail":"pass",message:K?K.getMessage():"Test passed",type:"test",name:J,duration:F};if(H){D.parent.results.failed++;}else{D.parent.results.passed++;}D.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}},_handleError:function(D){if(this._waiting){this._resumeTest(function(){throw D;});}else{throw D;}},_runTest:function(G){var D=G.testObject,E=G.parent.testObject,H=E[D],F=D.indexOf("ignore:")===0||!C(E.groups,this._groups)||(E._should.ignore||{})[D];if(F){G.parent.results[D]={result:"ignore",message:"Test ignored",type:"test",name:D.indexOf("ignore:")===0?D.substring(7):D};G.parent.results.ignored++;G.parent.results.total++;this.fire({type:this.TEST_IGNORE_EVENT,testCase:E,testName:D});if(typeof setTimeout!="undefined"){setTimeout(function(){YUITest.TestRunner._run();},0);}else{this._run();}}else{G._start=new Date();this._execNonTestMethod(G.parent,"setUp",false);this._resumeTest(H);}},getName:function(){return this.masterSuite.name;},setName:function(D){this.masterSuite.name=D;},add:function(D){this.masterSuite.add(D);return this;},clear:function(){this.masterSuite=new YUITest.TestSuite("yuitests"+(new Date()).getTime());},isWaiting:function(){return this._waiting;},isRunning:function(){return this._running;},getResults:function(D){if(!this._running&&this._lastResults){if(typeof D=="function"){return D(this._lastResults);}else{return this._lastResults;}}else{return null;}},getCoverage:function(D){if(!this._running&&typeof _yuitest_coverage=="object"){if(typeof D=="function"){return D(_yuitest_coverage);}else{return _yuitest_coverage;}}else{return null;}},callback:function(){var F=arguments,E=this._context,D=this;return function(){for(var G=0;G<arguments.length;G++){E[F[G]]=arguments[G];}D._run();};},resume:function(D){if(this._waiting){this._resumeTest(D||function(){});}else{throw new Error("resume() called without wait().");}},run:function(E){E=E||{};var F=YUITest.TestRunner,D=E.oldMode;if(!D&&this.masterSuite.items.length==1&&this.masterSuite.items[0] instanceof YUITest.TestSuite){this.masterSuite=this.masterSuite.items[0];}F._groups=(E.groups instanceof Array)?","+E.groups.join(",")+",":"";F._buildTestTree();F._context={};F._root._start=new Date();F.fire(F.BEGIN_EVENT);F._run();}});return new A();}();YUITest.Node={CLI:{}};YUITest.Node.CLI.Logger=function(){var B=YUITest.TestRunner;function A(D){var C="";switch(D.type){case B.BEGIN_EVENT:C="Testing began at "+(new Date()).toString()+".";messageType="info";break;case B.COMPLETE_EVENT:C="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+D.results.passed+" Failed:"+D.results.failed+" Total:"+D.results.total+"("+D.results.ignored+" ignored)";messageType="info";break;case B.TEST_FAIL_EVENT:C=D.testName+": failed.\n"+D.error.getMessage();messageType="fail";break;case B.ERROR_EVENT:C=D.methodName+": error.\n"+D.error.message;messageType="error";break;case B.TEST_IGNORE_EVENT:C=D.testName+": ignored.";messageType="ignore";break;case B.TEST_PASS_EVENT:C=D.testName+": passed.";messageType="pass";break;case B.TEST_SUITE_BEGIN_EVENT:C='Test suite "'+D.testSuite.name+'" started.';
messageType="info";break;case B.TEST_SUITE_COMPLETE_EVENT:C="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+D.results.passed+" Failed:"+D.results.failed+" Total:"+D.results.total+"("+D.results.ignored+" ignored)";messageType="info";break;case B.TEST_CASE_BEGIN_EVENT:C='Test case "'+D.testCase.name+'" started.';messageType="info";break;case B.TEST_CASE_COMPLETE_EVENT:C="Testing completed at "+(new Date()).toString()+".\n"+"Passed:"+D.results.passed+" Failed:"+D.results.failed+" Total:"+D.results.total+"("+D.results.ignored+" ignored)";messageType="info";break;default:C="Unexpected event "+D.type;messageType="info";}process.stdout.write(C+"\n");}B.subscribe(B.BEGIN_EVENT,A);B.subscribe(B.TEST_FAIL_EVENT,A);B.subscribe(B.TEST_PASS_EVENT,A);B.subscribe(B.TEST_IGNORE_EVENT,A);B.subscribe(B.TEST_CASE_BEGIN_EVENT,A);B.subscribe(B.TEST_CASE_COMPLETE_EVENT,A);B.subscribe(B.TEST_SUITE_BEGIN_EVENT,A);B.subscribe(B.TEST_SUITE_COMPLETE_EVENT,A);B.subscribe(B.COMPLETE_EVENT,A);};YUITest.Node.CLI.XUnit=function(){var F=YUITest.TestRunner,B=process.stdout,G=[],E=[],A=[];function D(J){if(J){var K=J.split("\n"),I=[],L,H;for(L=1,H=K.length;L<H;L++){if(K[L].indexOf("yuitest-node")>-1){break;}else{I.push(K[L]);}}return I.join("\n");}else{return"Unavailable.";}}function C(L){var K="",J=L.results,M=require("sys"),I,H;switch(L.type){case F.BEGIN_EVENT:K="YUITest for Node.js\n";if(F._groups){K+="Filtering on groups '"+F._groups.slice(1,-1)+"'\n";}break;case F.COMPLETE_EVENT:K="\nTotal tests: "+J.total+", Failures: "+J.failed+", Skipped: "+J.ignored+", Time: "+(J.duration/1000)+" seconds\n";if(E.length){K+="\nTests failed:\n";for(I=0,H=E.length;I<H;I++){K+="\n"+(I+1)+") "+E[I].name+" : "+E[I].error.getMessage()+"\n";K+="Stack trace:\n"+D(E[I].error.stack)+"\n";}K+="\n";}if(G.length){K+="\nErrors:\n";for(I=0,H=G.length;I<H;I++){K+="\n"+(I+1)+") "+G[I].name+" : "+G[I].error.message+"\n";K+="Stack trace:\n"+D(G[I].error.stack)+"\n";}K+="\n";}K+="\n\n";break;case F.TEST_FAIL_EVENT:K="F";E.push({name:A.concat([L.testName]).join(" > "),error:L.error});break;case F.ERROR_EVENT:G.push({name:A.concat([L.methodName]).join(" > "),error:L.error});break;case F.TEST_IGNORE_EVENT:K="S";break;case F.TEST_PASS_EVENT:K=".";break;case F.TEST_SUITE_BEGIN_EVENT:A.push(L.testSuite.name);break;case F.TEST_CASE_COMPLETE_EVENT:case F.TEST_SUITE_COMPLETE_EVENT:A.pop();break;case F.TEST_CASE_BEGIN_EVENT:A.push(L.testCase.name);break;}M.print(K);}F.subscribe(F.BEGIN_EVENT,C);F.subscribe(F.TEST_FAIL_EVENT,C);F.subscribe(F.TEST_PASS_EVENT,C);F.subscribe(F.ERROR_EVENT,C);F.subscribe(F.TEST_IGNORE_EVENT,C);F.subscribe(F.TEST_CASE_BEGIN_EVENT,C);F.subscribe(F.TEST_CASE_COMPLETE_EVENT,C);F.subscribe(F.TEST_SUITE_BEGIN_EVENT,C);F.subscribe(F.TEST_SUITE_COMPLETE_EVENT,C);F.subscribe(F.COMPLETE_EVENT,C);};YUITest.Node.CLI.Format=function(C){var B=YUITest.TestRunner;function A(E){var D=E.results,F=require("sys");F.print(C(D));}B.subscribe(B.COMPLETE_EVENT,A);};
View
11 javascript/build/yuitest/yuitest-node.js
@@ -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);
}
},
View
11 javascript/build/yuitest/yuitest.js
@@ -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);
}
},
View
11 javascript/src/core/TestCase.js
@@ -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);
}
},
Please sign in to comment.
Something went wrong with that request. Please try again.