/**
* QUnit v1.11.0 - A JavaScript Unit Testing Framework
*
* http://qunitjs.com
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
/**
* jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |
* http://flesler.blogspot.com Licensed under BSD
* (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008
*
* @projectDescription Advanced and extensible data dumping for Javascript.
* @version 1.0.0
* @author Ariel Flesler
* @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
*/
/*
* Javascript Diff Algorithm
* By John Resig (http://ejohn.org/)
* Modified by Chu Alan "sprite"
*
* Released under the MIT license.
*
* More Info:
* http://ejohn.org/projects/javascript-diff-algorithm/
*
* Usage: QUnit.diff(expected, actual)
*
* QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over"
*/
!function(e){function t(e){p(this,e),this.assertions=[],this.testNumber=++t.count}function n(){x.autorun=!0,x.currentModule&&y("moduleDone",q,{name:x.currentModule,failed:x.moduleStats.bad,passed:x.moduleStats.all-x.moduleStats.bad,total:x.moduleStats.all});var t,n,r=v("qunit-banner"),s=v("qunit-tests"),o=+new M-x.started,i=x.stats.all-x.stats.bad,a=["Tests completed in ",o," milliseconds. ","",i," assertions of ",x.stats.all," passed, ",x.stats.bad," failed."].join("");if(r&&(r.className=x.stats.bad?"qunit-fail":"qunit-pass"),s&&(v("qunit-testresult").innerHTML=a),x.altertitle&&"undefined"!=typeof document&&document.title&&(document.title=[x.stats.bad?"✖":"✔",document.title.replace(/^[\u2714\u2716] /i,"")].join(" ")),x.reorder&&L.sessionStorage&&0===x.stats.bad)for(t=0;t&]/g,function(e){switch(e){case"'":return"'";case'"':return""";case"<":return"<";case">":return">";case"&":return"&"}})):""}function a(e,t){x.queue.push(e),x.autorun&&!x.blocking&&u(t)}function u(t){function r(){u(t)}var s=(new M).getTime();for(x.depth=x.depth?x.depth+1:1;x.queue.length&&!x.blocking;){if(!(!L.setTimeout||x.updateRate<=0||(new M).getTime()-s0&&q.pushFailure("Introduced global variable(s): "+e.join(", ")),t=d(n,x.pollution),t.length>0&&q.pushFailure("Deleted global variable(s): "+t.join(", "))}function d(e,t){var n,r,s=e.slice();for(n=0;n-1}function g(e,t){h(e,t)||(e.className+=(e.className?" ":"")+t)}function b(t,n){for(var r=" "+t.className+" ";r.indexOf(" "+n+" ")>-1;)r=r.replace(" "+n+" "," ");t.className=e.jQuery?jQuery.trim(r):r.trim?r.trim():r}function v(e){return!("undefined"==typeof document||!document||!document.getElementById)&&document.getElementById(e)}function w(e){return function(t){x[e].push(t)}}function y(e,t,n){var r,s;if(q.hasOwnProperty(e))q[e].call(t,n);else for(s=x[e],r=0;rn;n++)if(t[n]===e)return n;return-1}var q,T,x,k,S=0,N=(o(0)||"").replace(/(:\d+)+\)?/,"").replace(/.+\//,""),j=Object.prototype.toString,C=Object.prototype.hasOwnProperty,M=e.Date,L={setTimeout:"undefined"!=typeof e.setTimeout,sessionStorage:function(){var e="qunit-test-string";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(t){return!1}}()},D=function(e){var t,n,r=e.toString();return"[object"===r.substring(0,7)?(t=e.name?e.name.toString():"Error",n=e.message?e.message.toString():"",t&&n?t+": "+n:t?t:n?n:"Error"):r},H=function(e){var t,n,r=q.is("array",e)?[]:{};for(t in e)C.call(e,t)&&(n=e[t],r[t]=n===Object(n)?H(n):n);return r};t.count=0,t.prototype={init:function(){var e,t,n,r=v("qunit-tests");r&&(t=document.createElement("strong"),t.innerHTML=this.nameHtml,e=document.createElement("a"),e.innerHTML="Rerun",e.href=q.url({testNumber:this.testNumber}),n=document.createElement("li"),n.appendChild(t),n.appendChild(e),n.className="running",n.id=this.id="qunit-test-output"+S++,r.appendChild(n))},setup:function(){if(this.module!==x.previousModule?(x.previousModule&&y("moduleDone",q,{name:x.previousModule,failed:x.moduleStats.bad,passed:x.moduleStats.all-x.moduleStats.bad,total:x.moduleStats.all}),x.previousModule=this.module,x.moduleStats={all:0,bad:0},y("moduleStart",q,{name:this.module})):x.autorun&&y("moduleStart",q,{name:this.module}),x.current=this,this.testEnvironment=p({setup:function(){},teardown:function(){}},this.moduleTestEnvironment),this.started=+new M,y("testStart",q,{name:this.testName,module:this.module}),q.current_testEnvironment=this.testEnvironment,x.pollution||l(),x.notrycatch)return this.testEnvironment.setup.call(this.testEnvironment),void 0;try{this.testEnvironment.setup.call(this.testEnvironment)}catch(e){q.pushFailure("Setup failed on "+this.testName+": "+(e.message||e),s(e,1))}},run:function(){x.current=this;var e=v("qunit-testresult");if(e&&(e.innerHTML="Running: "+this.nameHtml),this.async&&q.stop(),this.callbackStarted=+new M,x.notrycatch)return this.callback.call(this.testEnvironment,q.assert),this.callbackRuntime=+new M-this.callbackStarted,void 0;try{this.callback.call(this.testEnvironment,q.assert),this.callbackRuntime=+new M-this.callbackStarted}catch(t){this.callbackRuntime=+new M-this.callbackStarted,q.pushFailure("Died on test #"+(this.assertions.length+1)+" "+this.stack+": "+(t.message||t),s(t,0)),l(),x.blocking&&q.start()}},teardown:function(){if(x.current=this,x.notrycatch)return"undefined"==typeof this.callbackRuntime&&(this.callbackRuntime=+new M-this.callbackStarted),this.testEnvironment.teardown.call(this.testEnvironment),void 0;try{this.testEnvironment.teardown.call(this.testEnvironment)}catch(e){q.pushFailure("Teardown failed on "+this.testName+": "+(e.message||e),s(e,1))}c()},finish:function(){x.current=this,x.requireExpects&&null===this.expected?q.pushFailure("Expected number of assertions to be defined, but expect() was not called.",this.stack):null!==this.expected&&this.expected!==this.assertions.length?q.pushFailure("Expected "+this.expected+" assertions, but "+this.assertions.length+" were run",this.stack):null!==this.expected||this.assertions.length||q.pushFailure("Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.",this.stack);var t,n,r,s,o,i,a,u=this,l=0,c=0,d=v("qunit-tests");if(this.runtime=+new M-this.started,x.stats.all+=this.assertions.length,x.moduleStats.all+=this.assertions.length,d){for(a=document.createElement("ol"),a.className="qunit-assert-list",t=0;t("+c+", "+l+", "+this.assertions.length+")",f(s,"click",function(){var e=s.parentNode.lastChild,t=h(e,"qunit-collapsed");(t?b:g)(e,"qunit-collapsed")}),f(s,"dblclick",function(t){var n=t&&t.target?t.target:e.event.srcElement;("span"===n.nodeName.toLowerCase()||"b"===n.nodeName.toLowerCase())&&(n=n.parentNode),e.location&&"strong"===n.nodeName.toLowerCase()&&(e.location=q.url({testNumber:u.testNumber}))}),o=document.createElement("span"),o.className="runtime",o.innerHTML=this.runtime+" ms",i=v(this.id),i.className=c?"fail":"pass",i.removeChild(i.firstChild),r=i.firstChild,i.appendChild(s),i.appendChild(r),i.appendChild(o),i.appendChild(a)}else for(t=0;t"+i(e)+"";2===arguments.length&&(s=n,n=null),x.currentModule&&(l=""+i(x.currentModule)+": "+l),u=new t({nameHtml:l,testName:e,expected:n,async:a,callback:s,module:x.currentModule,moduleTestEnvironment:x.currentModuleTestEnvironment,stack:o(2)}),r(u)&&u.queue()},expect:function(e){return 1!==arguments.length?x.current.expected:(x.current.expected=e,void 0)},start:function(t){return void 0===x.semaphore?(q.begin(function(){setTimeout(function(){q.start(t)})}),void 0):(x.semaphore-=t||1,x.semaphore>0?void 0:x.semaphore<0?(x.semaphore=0,q.pushFailure("Called start() while already started (QUnit.config.semaphore was 0 already)",null,o(2)),void 0):(L.setTimeout?e.setTimeout(function(){x.semaphore>0||(x.timeout&&clearTimeout(x.timeout),x.blocking=!1,u(!0))},13):(x.blocking=!1,u(!0)),void 0))},stop:function(t){x.semaphore+=t||1,x.blocking=!0,x.testTimeout&&L.setTimeout&&(clearTimeout(x.timeout),x.timeout=e.setTimeout(function(){q.ok(!1,"Test timed out"),x.semaphore=1,q.start()},x.testTimeout))}},T={ok:function(e,t){if(!x.current)throw new Error("ok() assertion outside test context, was "+o(2));e=!!e;var n,r={module:x.current.module,name:x.current.testName,result:e,message:t};t=i(t||(e?"okay":"failed")),t=""+t+"",e||(n=o(2),n&&(r.source=n,t+="
Source:
"+i(n)+"
")),y("log",q,r),x.current.assertions.push({result:e,message:t})},equal:function(e,t,n){q.push(t==e,e,t,n)},notEqual:function(e,t,n){q.push(t!=e,e,t,n)},propEqual:function(e,t,n){e=H(e),t=H(t),q.push(q.equiv(e,t),e,t,n)},notPropEqual:function(e,t,n){e=H(e),t=H(t),q.push(!q.equiv(e,t),e,t,n)},deepEqual:function(e,t,n){q.push(q.equiv(e,t),e,t,n)},notDeepEqual:function(e,t,n){q.push(!q.equiv(e,t),e,t,n)},strictEqual:function(e,t,n){q.push(t===e,e,t,n)},notStrictEqual:function(e,t,n){q.push(t!==e,e,t,n)},"throws":function(e,t,n){var r,s=t,o=!1;"string"==typeof t&&(n=t,t=null),x.current.ignoreGlobalErrors=!0;try{e.call(x.current.testEnvironment)}catch(i){r=i}x.current.ignoreGlobalErrors=!1,r?(t?"regexp"===q.objectType(t)?o=t.test(D(r)):r instanceof t?o=!0:t.call({},r)===!0&&(s=null,o=!0):(o=!0,s=null),q.push(o,r,s,n)):q.pushFailure(n,null,"No exception was thrown.")}},p(q,T),q.raises=T["throws"],q.equals=function(){q.push(!1,!1,!1,"QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead")},q.same=function(){q.push(!1,!1,!1,"QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead")},function(){function e(){}e.prototype=q,q=new e,q.constructor=e}(),x={queue:[],blocking:!0,hidepassed:!1,reorder:!0,altertitle:!0,requireExpects:!1,urlConfig:[{id:"noglobals",label:"Check for Globals",tooltip:"Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."},{id:"notrycatch",label:"No try-catch",tooltip:"Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."}],modules:{},begin:[],done:[],log:[],testStart:[],testDone:[],moduleStart:[],moduleDone:[]},"undefined"==typeof exports&&(p(e,q),e.QUnit=q),function(){var t,n,r=e.location||{search:"",protocol:"file:"},s=r.search.slice(1).split("&"),o=s.length,i={};if(s[0])for(t=0;o>t;t++)n=s[t].split("="),n[0]=decodeURIComponent(n[0]),n[1]=n[1]?decodeURIComponent(n[1]):!0,i[n[0]]=n[1];q.urlParams=i,x.filter=i.filter,x.module=i.module,x.testNumber=parseInt(i.testNumber,10)||null,q.isLocal="file:"===r.protocol}(),p(q,{assert:T,config:x,init:function(){p(x,{stats:{all:0,bad:0},moduleStats:{all:0,bad:0},started:+new M,updateRate:1e3,blocking:!1,autostart:!0,autorun:!1,filter:"",queue:[],semaphore:1});var e,t,n,r=v("qunit");r&&(r.innerHTML="
"+i(document.title)+"
"+""+""+""+""),e=v("qunit-tests"),t=v("qunit-banner"),n=v("qunit-testresult"),e&&(e.innerHTML=""),t&&(t.className=""),n&&n.parentNode.removeChild(n),e&&(n=document.createElement("p"),n.id="qunit-testresult",n.className="result",e.parentNode.insertBefore(n,e),n.innerHTML="Running... ")},reset:function(){var e=v("qunit-fixture");e&&(e.innerHTML=x.fixture)},triggerEvent:function(e,t,n){document.createEvent?(n=document.createEvent("MouseEvents"),n.initMouseEvent(t,!0,!0,e.ownerDocument.defaultView,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(n)):e.fireEvent&&e.fireEvent("on"+t)},is:function(e,t){return q.objectType(t)===e},objectType:function(e){if("undefined"==typeof e)return"undefined";if(null===e)return"null";var t=j.call(e).match(/^\[object\s(.*)\]$/),n=t&&t[1]||"";switch(n){case"Number":return isNaN(e)?"nan":"number";case"String":case"Boolean":case"Array":case"Date":case"RegExp":case"Function":return n.toLowerCase()}return"object"==typeof e?"object":void 0},push:function(e,t,n,r){if(!x.current)throw new Error("assertion outside test context, was "+o());var s,a,u={module:x.current.module,name:x.current.testName,result:e,message:r,actual:t,expected:n};r=i(r)||(e?"okay":"failed"),r=""+r+"",s=r,e||(n=i(q.jsDump.parse(n)),t=i(q.jsDump.parse(t)),s+="
Expected:
"+n+"
",t!==n&&(s+="
Result:
"+t+"
",s+="
Diff:
"+q.diff(n,t)+"
"),a=o(),a&&(u.source=a,s+="
Source:
"+i(a)+"
"),s+="
"),y("log",q,u),x.current.assertions.push({result:!!e,message:s})},pushFailure:function(e,t,n){if(!x.current)throw new Error("pushFailure() assertion outside test context, was "+o(2));var r,s={module:x.current.module,name:x.current.testName,result:!1,message:e};e=i(e)||"error",e=""+e+"",r=e,r+="