/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.widget.DocTester"],["require","dojo.string"],["require","dijit._Widget"],["require","dijit._Templated"],["require","dojox.form.BusyButton"],["require","dojox.testing.DocTest"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.widget.DocTester"]){_4._hasResource["dojox.widget.DocTester"]=true;_4.provide("dojox.widget.DocTester");_4.require("dojo.string");_4.require("dijit._Widget");_4.require("dijit._Templated");_4.require("dojox.form.BusyButton");_4.require("dojox.testing.DocTest");_4.declare("dojox.widget.DocTester",[_5._Widget,_5._Templated],{templateString:_4.cache("dojox.widget","DocTester/DocTester.html","<div dojoAttachPoint=\"domNode\" class=\"dojoxDocTester\">\r\n\t<div dojoAttachPoint=\"containerNode\"></div>\r\n\t<button dojoType=\"dojox.form.BusyButton\" busyLabel=\"Testing...\" dojoAttachPoint=\"runButtonNode\">Run tests</button>\r\n\t<button dojoType=\"dijit.form.Button\" dojoAttachPoint=\"resetButtonNode\" style=\"display:none;\">Reset</button>\r\n\t<span>\r\n\t\t<span dojoAttachPoint=\"numTestsNode\">0</span> tests,\r\n\t\t<span dojoAttachPoint=\"numTestsOkNode\">0</span> passed,\r\n\t\t<span dojoAttachPoint=\"numTestsNokNode\">0</span> failed\r\n\t</span>\r\n</div>\r\n"),widgetsInTemplate:true,_fillContent:function(_7){var _8=_7.innerHTML;this.doctests=new _6.testing.DocTest();this.tests=this.doctests.getTestsFromString(this._unescapeHtml(_8));var _9=_4.map(this.tests,"return item.line-1");var _a=_8.split("\n");var _b="<div class=\"actualResult\">FAILED, actual result was: <span class=\"result\"></span></div>";var _c="<pre class=\"testCase testNum0 odd\">";for(var i=0;i<_a.length;i++){var _d=_4.indexOf(_9,i);if(_d>0&&_d!=-1){var _e=_d%2?"even":"odd";_c+=_b;_c+="</pre><pre class=\"testCase testNum"+_d+" "+_e+"\">";}_c+=_a[i].replace(/^\s+/,"")+"\n";}_c+=_b+"</pre>";this.containerNode.innerHTML=_c;},postCreate:function(){this.inherited("postCreate",arguments);_4.connect(this.runButtonNode,"onClick",_4.hitch(this,"runTests"));_4.connect(this.resetButtonNode,"onClick",_4.hitch(this,"reset"));this.numTestsNode.innerHTML=this.tests.length;},runTests:function(){var _f={ok:0,nok:0};for(var i=0;i<this.tests.length;i++){var ret=this.doctests.runTest(this.tests[i].commands,this.tests[i].expectedResult);_4.query(".testNum"+i,this.domNode).addClass(ret.success?"resultOk":"resultNok");if(!ret.success){_f.nok++;this.numTestsNokNode.innerHTML=_f.nok;var act=_4.query(".testNum"+i+" .actualResult",this.domNode)[0];_4.style(act,"display","inline");_4.query(".result",act)[0].innerHTML=_4.toJson(ret.actualResult);}else{_f.ok++;this.numTestsOkNode.innerHTML=_f.ok;}}this.runButtonNode.cancel();_4.style(this.runButtonNode.domNode,"display","none");_4.style(this.resetButtonNode.domNode,"display","");},reset:function(){_4.style(this.runButtonNode.domNode,"display","");_4.style(this.resetButtonNode.domNode,"display","none");this.numTestsOkNode.innerHTML="0";this.numTestsNokNode.innerHTML="0";_4.query(".actualResult",this.domNode).style("display","none");_4.query(".testCase",this.domNode).removeClass("resultOk").removeClass("resultNok");},_unescapeHtml:function(str){str=String(str).replace(/&amp;/gm,"&").replace(/&lt;/gm,"<").replace(/&gt;/gm,">").replace(/&quot;/gm,"\"");return str;}});}}};});