[Dojo-checkins] r785 - tests/webui/widgets

dojo-checkins at dojotoolkit.org dojo-checkins at dojotoolkit.org
Tue Jun 28 11:43:13 PDT 2005


Author: alex
Date: Tue Jun 28 11:43:12 2005
New Revision: 785

Added:
   tests/webui/widgets/test_lots_of_buttons.html
Log:
timing test. We're still kinda slow = (


Added: tests/webui/widgets/test_lots_of_buttons.html
==============================================================================
--- (empty file)
+++ tests/webui/widgets/test_lots_of_buttons.html	Tue Jun 28 11:43:12 2005
@@ -0,0 +1,69 @@
+<html>
+	<head>
+		<script language="JavaScript" type="text/javascript">
+			// Dojo configuration
+			djConfig = { 
+				isDebug: true
+			};
+		</script>
+		<script language="JavaScript" type="text/javascript" 
+			src="../../../__package__.js"></script>
+		<script language="JavaScript" type="text/javascript">
+			dojo.hostenv.loadModule("dojo.xml.Parse");
+			dojo.hostenv.loadModule("dojo.webui.widgets.Parse");
+			dojo.hostenv.loadModule("dojo.webui.widgets.Button");
+			dojo.hostenv.loadModule("dojo.webui.widgets.HTMLButton");
+			
+			function outputObjectInfo(x, tid){
+				if(!tid){
+					tid = 0;
+				}
+				/*
+				if(!indent){ indent = 0; }
+				var pa = [];
+				for(var x=0; x<indent; x++){
+					pa.push(".");
+				}
+				indent++;
+				var prefix = pa.join("");
+				alert("WTF?"+x);
+				*/
+				tid++;
+				var prefix = ".";
+				for(var blah=0; blah<tid; blah++){
+					prefix+=".";
+				}
+				for(var y in x){
+					if((typeof x[y] == "object")&&(x[y] != x.nodeRef)){
+						if(!(x instanceof Array && !isNaN(parseInt(y)))){
+							dojo.hostenv.println(prefix+" "+y+": "+x[y]);
+						}
+						outputObjectInfo(x[y], tid);
+					} else {
+						dojo.hostenv.println(prefix+" "+y+": "+x[y]);
+					}
+				}
+			}
+
+			function init(){
+				// var start = new Date();
+				var start = new Date();
+				for(var x = 0; x<100; x++){
+					dojo.webui.widgets.fromScript(document.body.appendChild(document.createElement("span")), 
+													"Button", { label: "button "+x });
+				}
+				dj_debug("constructing ", x, " items took ", (new Date())-start, "ms");
+			}
+
+			dojo.event.connect(dojo.hostenv, "loaded", dj_global, "init");
+		</script>
+	</head>
+	<body>
+		Check your javascript log; the scripts were all loaded in the head.
+
+		<button id="testDojoButton" dojoType="button" label="this is a test button!" 
+			onClick="alert(this.domNode.innerHTML);" onFoo="dojo.hostenv.println('onFoo');">
+			you shouldn't be seeing this
+		</button>
+	</body>
+</html>


More information about the Dojo-checkins mailing list