//>>built
define("dojox/widget/DocTester",["dijit","dojo","dojox","dojo/require!dojo/string,dijit/_Widget,dijit/_Templated,dojox/form/BusyButton,dojox/testing/DocTest"],function(g,a,h){a.provide("dojox.widget.DocTester");a.require("dojo.string");a.require("dijit._Widget");a.require("dijit._Templated");a.require("dojox.form.BusyButton");a.require("dojox.testing.DocTest");a.declare("dojox.widget.DocTester",[g._Widget,g._Templated],{templateString:a.cache("dojox.widget","DocTester/DocTester.html",'\x3cdiv dojoAttachPoint\x3d"domNode" class\x3d"dojoxDocTester"\x3e\n\t\x3cdiv dojoAttachPoint\x3d"containerNode"\x3e\x3c/div\x3e\n\t\x3cbutton dojoType\x3d"dojox.form.BusyButton" busyLabel\x3d"Testing..." dojoAttachPoint\x3d"runButtonNode"\x3eRun tests\x3c/button\x3e\n\t\x3cbutton dojoType\x3d"dijit.form.Button" dojoAttachPoint\x3d"resetButtonNode" style\x3d"display:none;"\x3eReset\x3c/button\x3e\n\t\x3cspan\x3e\n\t\t\x3cspan dojoAttachPoint\x3d"numTestsNode"\x3e0\x3c/span\x3e tests,\n\t\t\x3cspan dojoAttachPoint\x3d"numTestsOkNode"\x3e0\x3c/span\x3e passed,\n\t\t\x3cspan dojoAttachPoint\x3d"numTestsNokNode"\x3e0\x3c/span\x3e failed\n\t\x3c/span\x3e\n\x3c/div\x3e'),
widgetsInTemplate:!0,_fillContent:function(c){var d=c.innerHTML;this.doctests=new h.testing.DocTest;this.tests=this.doctests.getTestsFromString(this._unescapeHtml(d));c=a.map(this.tests,"return item.line-1");d=d.split("\n");for(var b='\x3cpre class\x3d"testCase testNum0 odd"\x3e',e=0;e<d.length;e++){var f=a.indexOf(c,e);if(0<f&&-1!=f){var k=f%2?"even":"odd";b+='\x3cdiv class\x3d"actualResult"\x3eFAILED, actual result was: \x3cspan class\x3d"result"\x3e\x3c/span\x3e\x3c/div\x3e';b+='\x3c/pre\x3e\x3cpre class\x3d"testCase testNum'+
f+" "+k+'"\x3e'}b+=d[e].replace(/^\s+/,"")+"\n"}this.containerNode.innerHTML=b+'\x3cdiv class\x3d"actualResult"\x3eFAILED, actual result was: \x3cspan class\x3d"result"\x3e\x3c/span\x3e\x3c/div\x3e\x3c/pre\x3e'},postCreate:function(){this.inherited("postCreate",arguments);a.connect(this.runButtonNode,"onClick",a.hitch(this,"runTests"));a.connect(this.resetButtonNode,"onClick",a.hitch(this,"reset"));this.numTestsNode.innerHTML=this.tests.length},runTests:function(){for(var c=0,d=0,b=0;b<this.tests.length;b++){var e=
this.doctests.runTest(this.tests[b].commands,this.tests[b].expectedResult);a.query(".testNum"+b,this.domNode).addClass(e.success?"resultOk":"resultNok");if(e.success)c++,this.numTestsOkNode.innerHTML=c;else{d++;this.numTestsNokNode.innerHTML=d;var f=a.query(".testNum"+b+" .actualResult",this.domNode)[0];a.style(f,"display","inline");a.query(".result",f)[0].innerHTML=a.toJson(e.actualResult)}}this.runButtonNode.cancel();a.style(this.runButtonNode.domNode,"display","none");a.style(this.resetButtonNode.domNode,
"display","")},reset:function(){a.style(this.runButtonNode.domNode,"display","");a.style(this.resetButtonNode.domNode,"display","none");this.numTestsOkNode.innerHTML="0";this.numTestsNokNode.innerHTML="0";a.query(".actualResult",this.domNode).style("display","none");a.query(".testCase",this.domNode).removeClass("resultOk").removeClass("resultNok")},_unescapeHtml:function(c){return c=String(c).replace(/&amp;/gm,"\x26").replace(/&lt;/gm,"\x3c").replace(/&gt;/gm,"\x3e").replace(/&quot;/gm,'"')}})});