test-min.js revision b7fbb9334bba09cbce1ae5e689cbc13af6edbf97
YUI.add("test",function(B){B.namespace("Test");B.Test.Case=function(C){this._should={};for(var D in C){this[D]=C[D];}if(!B.Lang.isString(this.name)){this.name="testCase"+B.guid();}};B.Test.Case.prototype={resume:function(C){B.Test.Runner.resume(C);},wait:function(E,D){var C=arguments;if(B.Lang.isFunction(C[0])){throw new B.Test.Wait(C[0],C[1]);}else{throw new B.Test.Wait(function(){B.Assert.fail("Timeout: wait() called but resume() never called.");},(B.Lang.isNumber(C[0])?C[0]:10000));}},setUp:function(){},tearDown:function(){}};B.Test.Wait=function(D,C){this.segment=(B.Lang.isFunction(D)?D:null);this.delay=(B.Lang.isNumber(C)?C:0);};B.namespace("Test");B.Test.Suite=function(C){this.name="";this.items=[];if(B.Lang.isString(C)){this.name=C;}else{if(B.Lang.isObject(C)){B.mix(this,C,true);}}if(this.name===""){this.name="testSuite"+B.guid();}};B.Test.Suite.prototype={add:function(C){if(C instanceof B.Test.Suite||C instanceof B.Test.Case){this.items.push(C);}},setUp:function(){},tearDown:function(){}};B.Test.Runner=(function(){function D(E){this.testObject=E;this.firstChild=null;this.lastChild=null;this.parent=null;this.next=null;this.results={passed:0,failed:0,total:0,ignored:0};if(E instanceof B.Test.Suite){this.results.type="testsuite";this.results.name=E.name;}else{if(E instanceof B.Test.Case){this.results.type="testcase";this.results.name=E.name;}}}D.prototype={appendChild:function(E){var F=new D(E);if(this.firstChild===null){this.firstChild=this.lastChild=F;}else{this.lastChild.next=F;this.lastChild=F;}F.parent=this;return F;}};function C(){C.superclass.constructor.apply(this,arguments);this.masterSuite=new B.Test.Suite("YUI Test Results");this._cur=null;this._root=null;this._log=true;this._waiting=false;var F=[this.TEST_CASE_BEGIN_EVENT,this.TEST_CASE_COMPLETE_EVENT,this.TEST_SUITE_BEGIN_EVENT,this.TEST_SUITE_COMPLETE_EVENT,this.TEST_PASS_EVENT,this.TEST_FAIL_EVENT,this.TEST_IGNORE_EVENT,this.COMPLETE_EVENT,this.BEGIN_EVENT];for(var E=0;E<F.length;E++){this.subscribe(F[E],this._logEvent,this,true);}}B.extend(C,B.Event.Target,{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",TEST_IGNORE_EVENT:"ignore",COMPLETE_EVENT:"complete",BEGIN_EVENT:"begin",disableLogging:function(){this._log=false;},enableLogging:function(){this._log=true;},_logEvent:function(G){var F="";var E="";switch(G.type){case this.BEGIN_EVENT:F="Testing began at "+(new Date()).toString()+".";E="info";break;case this.COMPLETE_EVENT:F="Testing completed at "+(new Date()).toString()+".\nPassed:"+G.results.passed+" Failed:"+G.results.failed+" Total:"+G.results.total;E="info";break;case this.TEST_FAIL_EVENT:F=G.testName+": "+G.error.getMessage();E="fail";break;case this.TEST_IGNORE_EVENT:F=G.testName+": ignored.";E="ignore";break;case this.TEST_PASS_EVENT:F=G.testName+": passed.";E="pass";break;case this.TEST_SUITE_BEGIN_EVENT:F='Test suite "'+G.testSuite.name+'" started.';E="info";break;case this.TEST_SUITE_COMPLETE_EVENT:F='Test suite "'+G.testSuite.name+'" completed.\nPassed:'+G.results.passed+" Failed:"+G.results.failed+" Total:"+G.results.total;E="info";break;case this.TEST_CASE_BEGIN_EVENT:F='Test case "'+G.testCase.name+'" started.';E="info";break;case this.TEST_CASE_COMPLETE_EVENT:F='Test case "'+G.testCase.name+'" completed.\nPassed:'+G.results.passed+" Failed:"+G.results.failed+" Total:"+G.results.total;E="info";break;default:F="Unexpected event "+G.type;F="info";}if(this._log){B.log(F,E,"TestRunner");}},_addTestCaseToTestTree:function(F,G){var H=F.appendChild(G),I,E;for(I in G){if((I.indexOf("test")===0||(I.toLowerCase().indexOf("should")>-1&&I.indexOf(" ")>-1))&&B.Lang.isFunction(G[I])){H.appendChild(I);}}},_addTestSuiteToTestTree:function(E,H){var G=E.appendChild(H);for(var F=0;F<H.items.length;F++){if(H.items[F] instanceof B.Test.Suite){this._addTestSuiteToTestTree(G,H.items[F]);}else{if(H.items[F] instanceof B.Test.Case){this._addTestCaseToTestTree(G,H.items[F]);}}}},_buildTestTree:function(){this._root=new D(this.masterSuite);this._cur=this._root;for(var E=0;E<this.masterSuite.items.length;E++){if(this.masterSuite.items[E] instanceof B.Test.Suite){this._addTestSuiteToTestTree(this._root,this.masterSuite.items[E]);}else{if(this.masterSuite.items[E] instanceof B.Test.Case){this._addTestCaseToTestTree(this._root,this.masterSuite.items[E]);}}}},_handleTestObjectComplete:function(E){if(B.Lang.isObject(E.testObject)){E.parent.results.passed+=E.results.passed;E.parent.results.failed+=E.results.failed;E.parent.results.total+=E.results.total;E.parent.results.ignored+=E.results.ignored;E.parent.results[E.testObject.name]=E.results;if(E.testObject instanceof B.Test.Suite){E.testObject.tearDown();this.fire(this.TEST_SUITE_COMPLETE_EVENT,{testSuite:E.testObject,results:E.results});}else{if(E.testObject instanceof B.Test.Case){this.fire(this.TEST_CASE_COMPLETE_EVENT,{testCase:E.testObject,results:E.results});}}}},_next:function(){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;}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.results.duration;this.fire(this.COMPLETE_EVENT,{results:this._cur.results});this._cur=null;}else{this._handleTestObjectComplete(this._cur);this._cur=this._cur.next;}}}return this._cur;},_run:function(){var G=false;var F=this._next();if(F!==null){var E=F.testObject;if(B.Lang.isObject(E)){if(E instanceof B.Test.Suite){this.fire(this.TEST_SUITE_BEGIN_EVENT,{testSuite:E});E.setUp();}else{if(E instanceof B.Test.Case){this.fire(this.TEST_CASE_BEGIN_EVENT,{testCase:E});}}if(typeof setTimeout!="undefined"){setTimeout(function(){B.Test.Runner._run();
},0);}else{this._run();}}else{this._runTest(F);}}},_resumeTest:function(I){var E=this._cur;if(!E){return;}var J=E.testObject;var G=E.parent.testObject;if(G.__yui_wait){clearTimeout(G.__yui_wait);delete G.__yui_wait;}var M=(G._should.fail||{})[J];var F=(G._should.error||{})[J];var H=false;var K=null;try{I.apply(G);if(M){K=new B.Assert.ShouldFail();H=true;}else{if(F){K=new B.Assert.ShouldError();H=true;}}}catch(L){if(G.__yui_wait){clearTimeout(G.__yui_wait);delete G.__yui_wait;}if(L instanceof B.Assert.Error){if(!M){K=L;H=true;}}else{if(L instanceof B.Test.Wait){if(B.Lang.isFunction(L.segment)){if(B.Lang.isNumber(L.delay)){if(typeof setTimeout!="undefined"){G.__yui_wait=setTimeout(function(){B.Test.Runner._resumeTest(L.segment);},L.delay);this._waiting=true;}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!F){K=new B.Assert.UnexpectedError(L);H=true;}else{if(B.Lang.isString(F)){if(L.message!=F){K=new B.Assert.UnexpectedError(L);H=true;}}else{if(B.Lang.isFunction(F)){if(!(L instanceof F)){K=new B.Assert.UnexpectedError(L);H=true;}}else{if(B.Lang.isObject(F)){if(!(L instanceof F.constructor)||L.message!=F.message){K=new B.Assert.UnexpectedError(L);H=true;}}}}}}}}if(H){this.fire(this.TEST_FAIL_EVENT,{testCase:G,testName:J,error:K});}else{this.fire(this.TEST_PASS_EVENT,{testCase:G,testName:J});}G.tearDown();E.parent.results[J]={result:H?"fail":"pass",message:K?K.getMessage():"Test passed",type:"test",name:J};if(H){E.parent.results.failed++;}else{E.parent.results.passed++;}E.parent.results.total++;this._waiting=false;if(typeof setTimeout!="undefined"){setTimeout(function(){B.Test.Runner._run();},0);}else{this._run();}},_handleError:function(E){if(this._waiting){this._resumeTest(function(){throw E;});}else{throw E;}},_runTest:function(H){var E=H.testObject;var F=H.parent.testObject;var I=F[E];var G=(F._should.ignore||{})[E];if(G){H.parent.results[E]={result:"ignore",message:"Test ignored",type:"test",name:E};H.parent.results.ignored++;H.parent.results.total++;this.fire(this.TEST_IGNORE_EVENT,{testCase:F,testName:E});if(typeof setTimeout!="undefined"){setTimeout(function(){B.Test.Runner._run();},0);}else{this._run();}}else{F.setUp();this._resumeTest(I);}},fire:function(E,F){F=F||{};F.type=E;C.superclass.fire.call(this,E,F);},add:function(E){this.masterSuite.add(E);},clear:function(){this.masterSuite.items=[];},isWaiting:function(){return this._waiting;},resume:function(E){this._resumeTest(E||function(){});},run:function(E){var F=B.Test.Runner;F._buildTestTree();F._root.results.duration=(new Date()).valueOf();F.fire(F.BEGIN_EVENT);F._run();}});return new C();})();B.Assert={_asserts:0,_formatMessage:function(D,C){var E=D;if(B.Lang.isString(D)&&D.length>0){return B.Lang.substitute(D,{message:C});}else{return C;}},_getCount:function(){return this._asserts;},_increment:function(){this._asserts++;},_reset:function(){this._asserts=0;},fail:function(C){throw new B.Assert.Error(B.Assert._formatMessage(C,"Test force-failed."));},areEqual:function(D,E,C){B.Assert._increment();if(D!=E){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,"Values should be equal."),D,E);}},areNotEqual:function(C,E,D){B.Assert._increment();if(C==E){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(D,"Values should not be equal."),C);}},areNotSame:function(C,E,D){B.Assert._increment();if(C===E){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(D,"Values should not be the same."),C);}},areSame:function(D,E,C){B.Assert._increment();if(D!==E){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,"Values should be the same."),D,E);}},isFalse:function(D,C){B.Assert._increment();if(false!==D){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,"Value should be false."),false,D);}},isTrue:function(D,C){B.Assert._increment();if(true!==D){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,"Value should be true."),true,D);}},isNaN:function(D,C){B.Assert._increment();if(!isNaN(D)){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,"Value should be NaN."),NaN,D);}},isNotNaN:function(D,C){B.Assert._increment();if(isNaN(D)){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(C,"Values should not be NaN."),NaN);}},isNotNull:function(D,C){B.Assert._increment();if(B.Lang.isNull(D)){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(C,"Values should not be null."),null);}},isNotUndefined:function(D,C){B.Assert._increment();if(B.Lang.isUndefined(D)){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(C,"Value should not be undefined."),undefined);}},isNull:function(D,C){B.Assert._increment();if(!B.Lang.isNull(D)){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,"Value should be null."),null,D);}},isUndefined:function(D,C){B.Assert._increment();if(!B.Lang.isUndefined(D)){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,"Value should be undefined."),undefined,D);}},isArray:function(D,C){B.Assert._increment();if(!B.Lang.isArray(D)){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(C,"Value should be an array."),D);}},isBoolean:function(D,C){B.Assert._increment();if(!B.Lang.isBoolean(D)){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(C,"Value should be a Boolean."),D);}},isFunction:function(D,C){B.Assert._increment();if(!B.Lang.isFunction(D)){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(C,"Value should be a function."),D);}},isInstanceOf:function(D,E,C){B.Assert._increment();if(!(E instanceof D)){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,"Value isn't an instance of expected type."),D,E);}},isNumber:function(D,C){B.Assert._increment();if(!B.Lang.isNumber(D)){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(C,"Value should be a number."),D);}},isObject:function(D,C){B.Assert._increment();if(!B.Lang.isObject(D)){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(C,"Value should be an object."),D);}},isString:function(D,C){B.Assert._increment();
if(!B.Lang.isString(D)){throw new B.Assert.UnexpectedValue(B.Assert._formatMessage(C,"Value should be a string."),D);}},isTypeOf:function(C,E,D){B.Assert._increment();if(typeof E!=C){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(D,"Value should be of type "+C+"."),expected,typeof E);}}};B.assert=function(D,C){B.Assert._increment();if(!D){throw new B.Assert.Error(B.Assert._formatMessage(C,"Assertion failed."));}};B.fail=B.Assert.fail;B.Assert.Error=function(C){arguments.callee.superclass.constructor.call(this,C);this.message=C;this.name="Assert Error";};B.extend(B.Assert.Error,Error,{getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();},valueOf:function(){return this.toString();}});B.Assert.ComparisonFailure=function(D,C,E){arguments.callee.superclass.constructor.call(this,D);this.expected=C;this.actual=E;this.name="ComparisonFailure";};B.extend(B.Assert.ComparisonFailure,B.Assert.Error,{getMessage:function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual:"+this.actual+" ("+(typeof this.actual)+")";}});B.Assert.UnexpectedValue=function(D,C){arguments.callee.superclass.constructor.call(this,D);this.unexpected=C;this.name="UnexpectedValue";};B.extend(B.Assert.UnexpectedValue,B.Assert.Error,{getMessage:function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";}});B.Assert.ShouldFail=function(C){arguments.callee.superclass.constructor.call(this,C||"This test should fail but didn't.");this.name="ShouldFail";};B.extend(B.Assert.ShouldFail,B.Assert.Error);B.Assert.ShouldError=function(C){arguments.callee.superclass.constructor.call(this,C||"This test should have thrown an error but didn't.");this.name="ShouldError";};B.extend(B.Assert.ShouldError,B.Assert.Error);B.Assert.UnexpectedError=function(C){arguments.callee.superclass.constructor.call(this,"Unexpected error: "+C.message);this.cause=C;this.name="UnexpectedError";this.stack=C.stack;};B.extend(B.Assert.UnexpectedError,B.Assert.Error);B.ArrayAssert={contains:function(E,D,C){B.Assert._increment();if(B.Array.indexOf(D,E)==-1){B.Assert.fail(B.Assert._formatMessage(C,"Value "+E+" ("+(typeof E)+") not found in array ["+D+"]."));}},containsItems:function(E,F,D){B.Assert._increment();for(var C=0;C<E.length;C++){if(B.Array.indexOf(F,E[C])==-1){B.Assert.fail(B.Assert._formatMessage(D,"Value "+E[C]+" ("+(typeof E[C])+") not found in array ["+F+"]."));}}},containsMatch:function(E,D,C){B.Assert._increment();if(typeof E!="function"){throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");}if(!B.Array.some(E)){B.Assert.fail(B.Assert._formatMessage(C,"No match found in array ["+D+"]."));}},doesNotContain:function(E,D,C){B.Assert._increment();if(B.Array.indexOf(D,E)>-1){B.Assert.fail(B.Assert._formatMessage(C,"Value found in array ["+D+"]."));}},doesNotContainItems:function(E,F,D){B.Assert._increment();for(var C=0;C<E.length;C++){if(B.Array.indexOf(F,E[C])>-1){B.Assert.fail(B.Assert._formatMessage(D,"Value found in array ["+F+"]."));}}},doesNotContainMatch:function(E,D,C){B.Assert._increment();if(typeof E!="function"){throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");}if(B.Array.some(E)){B.Assert.fail(B.Assert._formatMessage(C,"Value found in array ["+D+"]."));}},indexOf:function(G,F,C,E){B.Assert._increment();for(var D=0;D<F.length;D++){if(F[D]===G){if(C!=D){B.Assert.fail(B.Assert._formatMessage(E,"Value exists at index "+D+" but should be at index "+C+"."));}return;}}B.Assert.fail(B.Assert._formatMessage(E,"Value doesn't exist in array ["+F+"]."));},itemsAreEqual:function(E,F,D){B.Assert._increment();if(E.length!=F.length){B.Assert.fail(B.Assert._formatMessage(D,"Array should have a length of "+E.length+" but has a length of "+F.length));}for(var C=0;C<E.length;C++){if(E[C]!=F[C]){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(D,"Values in position "+C+" are not equal."),E[C],F[C]);}}},itemsAreEquivalent:function(F,G,C,E){B.Assert._increment();if(typeof C!="function"){throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");}if(F.length!=G.length){B.Assert.fail(B.Assert._formatMessage(E,"Array should have a length of "+F.length+" but has a length of "+G.length));}for(var D=0;D<F.length;D++){if(!C(F[D],G[D])){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(E,"Values in position "+D+" are not equivalent."),F[D],G[D]);}}},isEmpty:function(D,C){B.Assert._increment();if(D.length>0){B.Assert.fail(B.Assert._formatMessage(C,"Array should be empty."));}},isNotEmpty:function(D,C){B.Assert._increment();if(D.length===0){B.Assert.fail(B.Assert._formatMessage(C,"Array should not be empty."));}},itemsAreSame:function(E,F,D){B.Assert._increment();if(E.length!=F.length){B.Assert.fail(B.Assert._formatMessage(D,"Array should have a length of "+E.length+" but has a length of "+F.length));}for(var C=0;C<E.length;C++){if(E[C]!==F[C]){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(D,"Values in position "+C+" are not the same."),E[C],F[C]);}}},lastIndexOf:function(G,F,C,E){for(var D=F.length;D>=0;D--){if(F[D]===G){if(C!=D){B.Assert.fail(B.Assert._formatMessage(E,"Value exists at index "+D+" but should be at index "+C+"."));}return;}}B.Assert.fail(B.Assert._formatMessage(E,"Value doesn't exist in array."));}};B.ObjectAssert={areEqual:function(D,E,C){B.Assert._increment();B.Object.each(D,function(G,F){if(D[F]!=E[F]){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,"Values should be equal for property "+F),D[F],E[F]);}});},hasKey:function(C,D,E){B.Assert._increment();if(!B.Object.hasKey(D,C)){B.fail(B.Assert._formatMessage(E,"Property '"+C+"' not found on object."));}},hasKeys:function(E,C,F){B.Assert._increment();for(var D=0;D<E.length;D++){if(!B.Object.hasKey(C,E[D])){B.fail(B.Assert._formatMessage(F,"Property '"+E[D]+"' not found on object."));}}},ownsKey:function(C,D,E){B.Assert._increment();
if(!D.hasOwnProperty(C)){B.fail(B.Assert._formatMessage(E,"Property '"+C+"' not found on object instance."));}},ownsKeys:function(E,C,F){B.Assert._increment();for(var D=0;D<E.length;D++){if(!C.hasOwnProperty(E[D])){B.fail(B.Assert._formatMessage(F,"Property '"+E[D]+"' not found on object instance."));}}},ownsNoKeys:function(C,E){B.Assert._increment();var D=B.Object.keys(C);if(D.length>0){B.fail(B.Assert._formatMessage(E,"Object owns "+D.length+" properties but should own none."));}}};B.DateAssert={datesAreEqual:function(D,F,C){B.Assert._increment();if(D instanceof Date&&F instanceof Date){var E="";if(D.getFullYear()!=F.getFullYear()){E="Years should be equal.";}if(D.getMonth()!=F.getMonth()){E="Months should be equal.";}if(D.getDate()!=F.getDate()){E="Days of month should be equal.";}if(E.length){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,E),D,F);}}else{throw new TypeError("Y.Assert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(D,F,C){B.Assert._increment();if(D instanceof Date&&F instanceof Date){var E="";if(D.getHours()!=F.getHours()){E="Hours should be equal.";}if(D.getMinutes()!=F.getMinutes()){E="Minutes should be equal.";}if(D.getSeconds()!=F.getSeconds()){E="Seconds should be equal.";}if(E.length){throw new B.Assert.ComparisonFailure(B.Assert._formatMessage(C,E),D,F);}}else{throw new TypeError("DateY.AsserttimesAreEqual(): Expected and actual values must be Date objects.");}}};B.namespace("Test.Format");function A(C){return C.replace(/[<>"'&]/g,function(D){switch(D){case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"&":return"&";}});}B.Test.Format.JSON=function(C){return B.JSON.stringify(C);};B.Test.Format.XML=function(E){var C=B.Lang;var D="<"+E.type+' name="'+A(E.name)+'"';if(E.type=="test"){D+=' result="'+A(E.result)+'" message="'+A(E.message)+'">';}else{D+=' passed="'+E.passed+'" failed="'+E.failed+'" ignored="'+E.ignored+'" total="'+E.total+'">';B.Object.each(E,function(F,G){if(C.isObject(F)&&!C.isArray(F)){D+=arguments.callee(F);}});}D+="</"+E.type+">";return D;};B.namespace("Test");B.Test.Reporter=function(C,D){this.url=C;this.format=D||B.Test.Format.XML;this._fields=new Object();this._form=null;this._iframe=null;};B.Test.Reporter.prototype={constructor:B.Test.Reporter,addField:function(C,D){this._fields[C]=D;},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);if(B.UA.ie){this._iframe=document.createElement('<iframe name="yuiTestTarget" />');}else{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();B.Object.each(this._fields,function(E,F){if(typeof E!="function"){var D=document.createElement("input");D.type="hidden";D.name=F;D.value=E;this._form.appendChild(D);}});delete this._fields.results;delete this._fields.useragent;delete this._fields.timestamp;if(arguments[1]!==false){this._form.submit();}}};B.Mock=function(E){E=E||{};var C=null;try{C=B.Object(E);}catch(D){C={};B.log("Couldn't create mock with prototype.","warn","Mock");}B.Object.each(E,function(F){if(B.Lang.isFunction(E[F])){C[F]=function(){B.Assert.fail("Method "+F+"() was called but was not expected to be.");};}});return C;};B.Mock.expect=function(D,H){if(!D.__expectations){D.__expectations={};}if(H.method){var G=H.method,F=H.args||H.arguments||[],C=H.returns,J=B.Lang.isNumber(H.callCount)?H.callCount:1,E=H.error,I=H.run||function(){};D.__expectations[G]=H;H.callCount=J;H.actualCallCount=0;B.Array.each(F,function(K,L,M){if(!(M[L] instanceof B.Mock.Value)){M[L]=B.Mock.Value(B.Assert.areSame,[K],"Argument "+L+" of "+G+"() is incorrect.");}});if(J>0){D[G]=function(){try{H.actualCallCount++;B.Assert.areEqual(F.length,arguments.length,"Method "+G+"() passed incorrect number of arguments.");for(var M=0,K=F.length;M<K;M++){F[M].verify(arguments[M]);}I.apply(this,arguments);if(E){throw E;}}catch(L){B.Test.Runner._handleError(L);}return C;};}else{D[G]=function(){B.Assert.fail("Method "+G+"() should not have been called.");};}}else{if(H.property){D.__expectations[G]=H;}}};B.Mock.verify=function(C){B.Object.each(C.__expectations,function(D){if(D.method){B.Assert.areEqual(D.callCount,D.actualCallCount,"Method "+D.method+"() wasn't called the expected number of times.");}else{if(D.property){B.Assert.areEqual(D.value,C[D.property],"Property "+D.property+" wasn't set to the correct value.");}}});};B.Mock.Value=function(E,C,D){if(this instanceof B.Mock.Value){this.verify=function(G){var F=[].concat(C||[]);F.push(G);F.push(D);E.apply(null,F);};}else{return new B.Mock.Value(E,C,D);}};B.Mock.Value.Any=B.Mock.Value(function(){});B.Mock.Value.Boolean=B.Mock.Value(B.Assert.isBoolean);B.Mock.Value.Number=B.Mock.Value(B.Assert.isNumber);B.Mock.Value.String=B.Mock.Value(B.Assert.isString);B.Mock.Value.Object=B.Mock.Value(B.Assert.isObject);B.Mock.Value.Function=B.Mock.Value(B.Assert.isFunction);},"@VERSION@",{requires:["substitute","event-simulate","event"]});