//>>built
define("dojox/widget/DocTester",["dojo","dijit","dojox","dojo/require!dojo/string,dijit/_Widget,dijit/_Templated,dojox/form/BusyButton,dojox/testing/DocTest"],function(a,g,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",'<div dojoAttachPoint="domNode" class="dojoxDocTester">\n\t<div dojoAttachPoint="containerNode"></div>\n\t<button dojoType="dojox.form.BusyButton" busyLabel="Testing..." dojoAttachPoint="runButtonNode">Run tests</button>\n\t<button dojoType="dijit.form.Button" dojoAttachPoint="resetButtonNode" style="display:none;">Reset</button>\n\t<span>\n\t\t<span dojoAttachPoint="numTestsNode">0</span> tests,\n\t\t<span dojoAttachPoint="numTestsOkNode">0</span> passed,\n\t\t<span dojoAttachPoint="numTestsNokNode">0</span> failed\n\t</span>\n</div>'),
widgetsInTemplate:!0,_fillContent:function(f){var c=f.innerHTML;this.doctests=new h.testing.DocTest;this.tests=this.doctests.getTestsFromString(this._unescapeHtml(c));for(var f=a.map(this.tests,"return item.line-1"),c=c.split("\n"),b='<pre class="testCase testNum0 odd">',d=0;d<c.length;d++){var e=a.indexOf(f,d);if(0<e&&-1!=e)var g=e%2?"even":"odd",b=b+'<div class="actualResult">FAILED, actual result was: <span class="result"></span></div>',b=b+('</pre><pre class="testCase testNum'+e+" "+g+'">');b+=
c[d].replace(/^\s+/,"")+"\n"}this.containerNode.innerHTML=b+'<div class="actualResult">FAILED, actual result was: <span class="result"></span></div></pre>'},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 f=0,c=0,b=0;b<this.tests.length;b++){var d=this.doctests.runTest(this.tests[b].commands,
this.tests[b].expectedResult);a.query(".testNum"+b,this.domNode).addClass(d.success?"resultOk":"resultNok");if(d.success)f++,this.numTestsOkNode.innerHTML=f;else{c++;this.numTestsNokNode.innerHTML=c;var e=a.query(".testNum"+b+" .actualResult",this.domNode)[0];a.style(e,"display","inline");a.query(".result",e)[0].innerHTML=a.toJson(d.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(a){return a=(""+a).replace(/&amp;/gm,"&").replace(/&lt;/gm,"<").replace(/&gt;/gm,">").replace(/&quot;/gm,'"')}})});