aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dijit/tests/_programaticTest.html
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dijit/tests/_programaticTest.html')
-rw-r--r--includes/js/dijit/tests/_programaticTest.html109
1 files changed, 109 insertions, 0 deletions
diff --git a/includes/js/dijit/tests/_programaticTest.html b/includes/js/dijit/tests/_programaticTest.html
new file mode 100644
index 0000000..41b1815
--- /dev/null
+++ b/includes/js/dijit/tests/_programaticTest.html
@@ -0,0 +1,109 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>Dijit raw programatic test suite | The Dojo Toolkit</title>
+
+ <style type="text/css">
+ @import "../../dojo/resources/dojo.css";
+ @import "css/dijitTests.css";
+ body, html { width:100%; height:100%; margin:0; padding:0; background:#fff !important; }
+ </style>
+
+ <script type="text/javascript" src="../../dojo/dojo.js"
+ djConfig="parseOnLoad: true, isDebug: true"></script>
+ <script type="text/javascript" src="_testCommon.js"></script>
+
+ <script language="JavaScript" type="text/javascript">
+ dojo.require("dojo.data.ItemFileReadStore");
+ dojo.require("dijit.dijit-all");
+
+ var randomParams = function(){
+ // need better params to test passing
+ return { "length" : 20 };
+ };
+
+ var inspectClass = function(fullClassName){
+ var newDijit, newDijitDom, newDijitParam = null;
+ var createdWidgets = [];
+ className = eval(fullClassName); //
+
+ // just try to make the class:
+ try{
+ newDijit = new className({});
+ createdWidgets.push(newDijit);
+ }catch(e){
+ console.warn('new only: ',fullClassName,e);
+ }
+
+ // try starting this widget
+ try{
+ if (newDijit && newDijit.startup){ newDijit.startup(); }
+ }catch(e){
+ console.warn('call startup: ',fullClassName,e);
+ }
+
+ // try with a div in the dom
+ try{
+ var tmpDiv = dojo.body().appendChild(document.createElement('div'));
+ newDijitDom = new className({},tmpDiv);
+ createdWidgets.push(newDijitDom);
+ }catch(e){
+ console.warn('attached to div: ',fullClassName,e);
+ }
+
+ // lets pass random parameters
+ try{
+ var tmpDiv = dojo.body().appendChild(document.createElement('div'));
+ newDijitParam = new className(randomParams(),tmpDiv);
+ createdWidgets.push(newDijitParam);
+ }catch(e){
+ console.warn('random param test: ',fullClassName,e);
+ }
+ // add more tests ...
+
+ // cleanup after ourselves
+ dojo.forEach(createdWidgets,function(byeWidget){
+ try{
+ if(byeWidget.destroy){ byeWidget.destroy(); }
+ }catch(e){
+ console.warn('destroying: ',byeWidget.declaredClass,e,byeWidget);
+ }
+ });
+
+ };
+
+ var storeError = function(e,request){
+ console.warn(e,request);
+ };
+
+ var storeReady = function(items,request){
+ dojo.forEach(items,function(item){
+ var testClass = theStore.getValue(item,"className");
+ try{
+ inspectClass(testClass);
+ }catch(e){
+ console.warn(e);
+ }
+ });
+ };
+
+ var init = function(){
+ var request = {
+ query: { },
+ onComplete: storeReady,
+ onError: storeError
+ };
+ theStore.fetch(request);
+ };
+ dojo.addOnLoad(init);
+
+ </script>
+
+</head>
+<body>
+ <div dojoType="dojo.data.ItemFileReadStore" jsId="theStore"
+ url="../tests/_data/dijits.json"></div>
+
+</body>
+</html>