root / trunk / tests / widget / tree / test_Tree_9.html

Revision 3476, 2.0 kB (checked in by ilia, 3 years ago)
  • minor bugfix with empty line instead of deleted container
  • test_9 made more verbose
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2        "http://www.w3.org/TR/html4/strict.dtd">
3<html>
4<head>
5<title>Dojo Tree Widget Test</title>
6
7<script type="text/javascript">
8        var djConfig = {isDebug: true, debugAtAllCosts: true };
9</script>
10<script type="text/javascript" src="../../../dojo.js"></script>
11<script type="text/javascript">
12        dojo.require("dojo.lang.*");
13        dojo.require("dojo.widget.*");
14        dojo.require("dojo.widget.Tree");
15        dojo.require("dojo.widget.TreeSelector");
16        dojo.hostenv.writeIncludes();
17
18
19        dojo.addOnLoad(function() {
20
21                // Hook before dojo.event.publish to print all events
22                var reporter = {
23                        beforePublish: function(topic, message) {
24                                dojo.debug("Going to publish:"+topic);
25                        },
26
27                        beforeSubscribe: function(topic, message) {
28                                dojo.debug("Going to subscribe:"+topic);
29                        }
30                }
31
32                dojo.event.kwConnect({
33                        type: "before",
34                        srcObj: dojo.event.topic,
35                        srcFunc: "publish",
36                        targetObj: reporter,
37                        targetFunc: "beforePublish"
38                });
39
40
41                dojo.event.kwConnect({
42                        type: "before",
43                        srcObj: dojo.event.topic.TopicImpl,
44                        srcFunc: "subscribe",
45                        targetObj: reporter,
46                        targetFunc: "report"
47                });
48
49        });
50
51
52        function kill() {
53                dojo.debug("RUN DESTROY...");
54                dojo.widget.byId('tree').destroy();
55                dojo.debug("...DONE DESTROY");
56        }
57
58        function print() {
59                dojo.debug('---');
60                dojo.debug("Dumping all widgets:");
61                dojo.lang.forEach(dojo.widget.manager.getAllWidgets(),
62                        function(t) { dojo.debug(t.widgetType) }
63                );
64                dojo.debug('---');
65        }
66
67        function test() {
68                print();
69                kill();
70                dojo.debug("Must be no widgets now");
71                print();
72        }
73
74
75</script>
76
77</head>
78<body>
79
80<h2>Destroy Tree</h2>
81
82<div dojoType="Tree" id="tree">
83        <div dojoType="TreeNode" title="Item 1">
84                <div dojoType="TreeNode" title="Item 1.1" ></div>
85        </div>
86        <div dojoType="TreeNode" title="Item 2" ></div>
87</div>
88
89
90<input type=button onClick="test(); this.disabled='disabled'" value="Destroy tree"/>
91
92
93
94</body>
95</html>
Note: See TracBrowser for help on using the browser.