芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/lib/yuilib/3.17.2/test/test-min.js
/* YUI 3.17.2 (build 9c3c78e) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add("test",function(e,t){YUI.YUITest?e.Test=YUI.YUITest:(YUITest={version:"3.17.2",guid:function(t){return e.guid(t)}},e.namespace("Test"),YUITest.Object=e.Object,YUITest.Array=e.Array,YUITest.Util={mix:e.mix,JSON:e.JSON},YUITest.EventTarget=function(){this._handlers={}},YUITest.EventTarget.prototype={constructor:YUITest.EventTarget,attach:function(e,t){typeof this._handlers[e]=="undefined"&&(this._handlers[e]=[]),this._handlers[e].push(t)},subscribe:function(e,t){this.attach.apply(this,arguments)},fire:function(e){typeof e=="string"&&(e={type:e}),e.target||(e.target=this);if(!e.type)throw new Error("Event object missing 'type' property.");if(this._handlers[e.type]instanceof Array){var t=this._handlers[e.type];for(var n=0,r=t.length;n
=2?arguments[1]:undefined,function(){var r=arguments;t===undefined&&(t=this),n.resume(function(){e.apply(t,r)})}},waitFor:function(e,t,n,r){var i=this,s;(typeof e!="function"||typeof t!="function")&&i.fail("waitFor() called with invalid parameters."),typeof n!="number"&&(n=YUITest.TestCase.DEFAULT_WAIT),s=+(new Date)+n,typeof r!="number"&&(r=100),i.wait(function(){var n;e.call(i)?t.call(i):(n=+(new Date),n>s?YUITest.TestCase._waitTimeout():i.waitFor(e,t,s-n,r))},r)},assert:function(e,t){YUITest.Assert._increment();if(!e)throw new YUITest.AssertionError(YUITest.Assert._formatMessage(t,"Assertion failed."))},fail:function(e){YUITest.Assert.fail(e)},init:function(){},destroy:function(){},setUp:function(){},tearDown:function(){}},YUITest.TestFormat=function(){function e(e){return e.replace(/[<>"'&]/g,function(e){switch(e){case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"&":return"&"}})}return{JSON:function(e){return YUITest.Util.JSON.stringify(e)},XML:function(t){function n(t){var r="<"+t.type+' name="'+e(t.name)+'"';typeof t.duration=="number"&&(r+=' duration="'+t.duration+'"');if(t.type=="test")r+=' result="'+t.result+'" message="'+e(t.message)+'">';else{r+=' passed="'+t.passed+'" failed="'+t.failed+'" ignored="'+t.ignored+'" total="'+t.total+'">';for(var i in t)t.hasOwnProperty(i)&&t[i]&&typeof t[i]=="object"&&!(t[i]instanceof Array)&&(r+=n(t[i]))}return r+=""+t.type+">",r}return''+n(t)},JUnitXML:function(t){function n(t){var r="";switch(t.type){case"test":t.result!="ignore"&&(r='
',t.result=="fail"&&(r+='
"),r+="
");break;case"testcase":r='
';for(var i in t)t.hasOwnProperty(i)&&t[i]&&typeof t[i]=="object"&&!(t[i]instanceof Array)&&(r+=n(t[i]));r+="
";break;case"testsuite":for(var i in t)t.hasOwnProperty(i)&&t[i]&&typeof t[i]=="object"&&!(t[i]instanceof Array)&&(r+=n(t[i]));break;case"report":r="
";for(var i in t)t.hasOwnProperty(i)&&t[i]&&typeof t[i]=="object"&&!(t[i]instanceof Array)&&(r+=n(t[i]));r+="
"}return r}return''+n(t)},TAP:function(e){function n(e){var r="";switch(e.type){case"test":e.result!="ignore"?(r="ok "+t++ +" - "+e.name,e.result=="fail"&&(r="not "+r+" - "+e.message),r+="\n"):r="#Ignored test "+e.name+"\n";break;case"testcase":r="#Begin testcase "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var i in e)e.hasOwnProperty(i)&&e[i]&&typeof e[i]=="object"&&!(e[i]instanceof Array)&&(r+=n(e[i]));r+="#End testcase "+e.name+"\n";break;case"testsuite":r="#Begin testsuite "+e.name+"("+e.failed+" failed of "+e.total+")\n";for(var i in e)e.hasOwnProperty(i)&&e[i]&&typeof e[i]=="object"&&!(e[i]instanceof Array)&&(r+=n(e[i]));r+="#End testsuite "+e.name+"\n";break;case"report":for(var i in e)e.hasOwnProperty(i)&&e[i]&&typeof e[i]=="object"&&!(e[i]instanceof Array)&&(r+=n(e[i]))}return r}var t=1;return"1.."+e.total+"\n"+n(e)}}}(),YUITest.Reporter=function(e,t){this.url=e,this.format=t||YUITest.TestFormat.XML,this._fields=new Object,this._form=null,this._iframe=null},YUITest.Reporter.prototype={constructor:YUITest.Reporter,addField:function(e,t){this._fields[e]=t},clearFields:function(){this._fields=new Object},destroy:function(){this._form&&(this._form.parentNode.removeChild(this._form),this._form=null),this._iframe&&(this._iframe.parentNode.removeChild(this._iframe),this._iframe=null),this._fields=null},report:function(e){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('
')}catch(t){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(e),this._fields.useragent=navigator.userAgent,this._fields.timestamp=(new Date).toLocaleString();for(var n in this._fields){var r=this._fields[n];if(this._fields.hasOwnProperty(n)&&typeof r!="function"){var i=document.createElement("input");i.type="hidden",i.name=n,i.value=r,this._form.appendChild(i)}}delete this._fields.results,delete this._fields.useragent,delete this._fields.timestamp,arguments[1]!==!1&&this._form.submit()}},YUITest.TestRunner=function(){function e(e,t){if(!t.length)return!0;if(e)for(var n=0,r=e.length;n
-1)return!0;return!1}function t(e){this.testObject=e,this.firstChild=null,this.lastChild=null,this.parent=null,this.next=null,this.results=new YUITest.Results,e instanceof YUITest.TestSuite?(this.results.type="testsuite",this.results.name=e.name):e instanceof YUITest.TestCase&&(this.results.type="testcase",this.results.name=e.name)}function n(){YUITest.EventTarget.call(this),this.masterSuite=new YUITest.TestSuite(YUITest.guid("testSuite_")),this._cur=null,this._root=null,this._log=!0,this._waiting=!1,this._running=!1,this._lastResults=null,this._context=null,this._groups=""}return t.prototype={appendChild:function(e){var n=new t(e);return this.firstChild===null?this.firstChild=this.lastChild=n:(this.lastChild.next=n,this.lastChild=n),n.parent=this,n}},n.prototype=YUITest.Util.mix(new YUITest.EventTarget,{_ignoreEmpty:!1,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,t){var n=e.appendChild(t),r,i;for(r in t)(r.indexOf("test")===0||r.indexOf(" ")>-1)&&typeof t[r]=="function"&&n.appendChild(r)},_addTestSuiteToTestTree:function(e,t){var n=e.appendChild(t);for(var r=0;r
-1&&YUITest.Assert.fail(YUITest.Assert._formatMessage(n,"Value found in array ["+t+"]."))},doesNotContainItems:function(e,t,n){YUITest.Assert._increment();for(var r=0;r
-1&&YUITest.Assert.fail(YUITest.Assert._formatMessage(n,"Value found in array ["+t+"]."))},doesNotContainMatch:function(e,t,n){YUITest.Assert._increment();if(typeof e!="function")throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");this._some(t,e)&&YUITest.Assert.fail(YUITest.Assert._formatMessage(n,"Value found in array ["+t+"]."))},indexOf:function(e,t,n,r){YUITest.Assert._increment();for(var i=0;i
0&&YUITest.Assert.fail(YUITest.Assert._formatMessage(t,"Array should be empty."))},isNotEmpty:function(e,t){YUITest.Assert._increment (),e.length===0&&YUITest.Assert.fail(YUITest.Assert._formatMessage(t,"Array should not be empty."))},itemsAreSame:function(e,t,n){YUITest.Assert._increment(),e.length!=t.length&&YUITest.Assert.fail(YUITest.Assert._formatMessage(n,"Array should have a length of "+e.length+" but has a length of "+t.length));for(var r=0;r
=0;i--)if(t[i]===e){n!=i&&YUITest.Assert.fail(YUITest.Assert._formatMessage(r,"Value exists at index "+i+" but should be at index "+n+"."));return}YUITest.Assert.fail(YUITest.Assert._formatMessage(r,"Value doesn't exist in array."))},isUnique:function(t,n,r){YUITest.Assert._increment();if(!e.Lang.isArray(t))throw new TypeError("ArrayAssert.isUnique(): First argument must be an array");if(e.Lang.isValue(n)&&!e.Lang.isFunction(n))throw new TypeError("ArrayAssert.isUnique(): Second argument must be a function");e.Array.unique(t,n).length
0?e.replace("{message}",t):t},_getCount:function(){return this._asserts},_increment:function(){this._asserts++},_reset:function(){this._asserts=0},fail:function(e){throw new YUITest.AssertionError(YUITest.Assert._formatMessage(e,"Test force-failed."))},pass:function(e){YUITest.Assert._increment()},areEqual:function(e,t,n){YUITest.Assert._increment();if(e!=t)throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(n,"Values should be equal."),e,t)},areNotEqual:function(e,t,n){YUITest.Assert._increment();if(e==t)throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(n,"Values should not be equal."),e)},areNotSame:function(e,t,n){YUITest.Assert._increment();if(e===t)throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(n,"Values should not be the same."),e)},areSame:function(e,t,n){YUITest.Assert._increment();if(e!==t)throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(n,"Values should be the same."),e,t)},isFalse:function(e,t){YUITest.Assert._increment();if(!1!==e)throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(t,"Value should be false."),!1,e)},isTrue:function(e,t){YUITest.Assert._increment();if(!0!==e)throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(t,"Value should be true."),!0,e)},isNaN:function(e,t){YUITest.Assert._increment();if(!isNaN(e))throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(t,"Value should be NaN."),NaN,e)},isNotNaN:function(e,t){YUITest.Assert._increment();if(isNaN(e))throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(t,"Values should not be NaN."),NaN)},isNotNull:function(e,t){YUITest.Assert._increment();if(e===null)throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(t,"Values should not be null."),null)},isNotUndefined:function(e,t){YUITest.Assert._increment();if(typeof e=="undefined")throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(t,"Value should not be undefined."),undefined)},isNull:function(e,t){YUITest.Assert._increment();if(e!==null)throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(t,"Value should be null."),null,e)},isUndefined:function(e,t){YUITest.Assert._increment();if(typeof e!="undefined")throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(t,"Value should be undefined."),undefined,e)},isArray:function(e,t){YUITest.Assert._increment();var n=!1;Array.isArray?n=!Array.isArray(e):n=Object.prototype.toString.call(e)!="[object Array]";if(n)throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(t,"Value should be an array."),e)},isBoolean:function(e,t){YUITest.Assert._increment();if(typeof e!="boolean")throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(t,"Value should be a Boolean."),e)},isFunction:function(e,t){YUITest.Assert._increment();if(!(e instanceof Function))throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(t,"Value should be a function."),e)},isInstanceOf:function(e,t,n){YUITest.Assert._increment();if(!(t instanceof e))throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(n,"Value isn't an instance of expected type."),e,t)},isNumber:function(e,t){YUITest.Assert._increment();if(typeof e!="number")throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(t,"Value should be a number."),e)},isObject:function(e,t){YUITest.Assert._increment();if(!e||typeof e!="object"&&typeof e!="function")throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(t,"Value should be an object."),e)},isString:function(e,t){YUITest.Assert._increment();if(typeof e!="string")throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(t,"Value should be a string."),e)},isTypeOf:function(e,t,n){YUITest.Assert._increment();if(typeof t!=e)throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(n,"Value should be of type "+e+"."),e,typeof t)},throwsError:function(e,t,n){YUITest.Assert._increment();var r=!1;try{t()}catch(i){if(typeof e=="string")i.message!=e&&(r=!0);else if(typeof e=="function")i instanceof e||(r=!0);else if(typeof e=="object"&&e!==null){if(!(i instanceof e.constructor)||i.message!=e.message)r=!0}else r=!0;if(r)throw new YUITest.UnexpectedError(i);return}throw new YUITest.AssertionError(YUITest.Assert._formatMessage(n,"Error should have been thrown."))}},YUITest.AssertionError=function(e){this.message=e,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(e,t,n){YUITest.AssertionError.call(this,e),this.expected=t,this.actual=n,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.CoverageFormat={JSON:function(e){return YUITest.Util.JSON.stringify(e)},XdebugJSON:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n].lines);return YUITest.Util.JSON.stringify(e)}},YUITest.DateAssert={datesAreEqual:function(e,t,n){YUITest.Assert._increment();if(!(e instanceof Date&&t instanceof Date))throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");var r="";e.getFullYear()!=t.getFullYear()&&(r="Years should be equal."),e.getMonth()!=t.getMonth()&&(r="Months should be equal."),e.getDate()!=t.getDate()&&(r="Days of month should be equal.");if(r.length)throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(n,r),e,t)},timesAreEqual:function(e,t,n){YUITest.Assert._increment();if(!(e instanceof Date&&t instanceof Date))throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");var r="";e.getHours()!=t.getHours()&&(r="Hours should be equal."),e.getMinutes()!=t.getMinutes()&&(r="Minutes should be equal."),e.getSeconds()!=t.getSeconds()&&(r="Seconds should be equal.");if(r.length)throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(n,r),e,t)}},YUITest.Mock=function(e){e=e||{};var t,n;try{function r(){}r.prototype=e,t=new r}catch(i){t={}}for(n in e)e.hasOwnProperty(n)&&typeof e[n]=="function"&&(t[n]=function(e){return function(){YUITest.Assert.fail("Method "+e+"() was called but was not expected to be.")}}(n));return t},YUITest.Mock.expect=function(e,t){e.__expectations||(e.__expectations={});if(t.method){var n=t.method,r=t.args||[],i=t.returns,s=typeof t.callCount=="number"?t.callCount:1,o=t.error,u=t.run||function(){},a,f;e.__expectations[n]=t,t.callCount=s,t.actualCallCount=0;for(f=0;f
0?e[n]=function(){try{t.actualCallCount++,YUITest.Assert.areEqual(r.length,arguments.length,"Method "+n+"() passed incorrect number of arguments.");for(var e=0,s=r.length;e
-1&&e.Test.Runner.subscribe(s,r)}},"3.17.2",{requires:["event-simulate","event-custom","json-stringify"]});