Ticket #566: test_Part.html

File test_Part.html, 2.9 kB (added by Morris Johns, 3 years ago)

The test_Part.html file in the zip file is just plain WRONG!

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2        "http://www.w3.org/TR/html4/strict.dtd">
3
4<title>Dojo Button Widget Test</title>
5
6<script type="text/javascript">
7        var djConfig = {isDebug: true /*, debugAtAllCosts: true*/ };
8</script>
9
10<script type="text/javascript" src="../../dojo.js"></script>
11<script type="text/javascript">
12        dojo.require("dojo.widget.*");
13        dojo.require("dojo.event.*");
14        dojo.require("dojo.widget.Part");
15
16        dojo.hostenv.writeIncludes();
17</script>
18
19<script>
20        // Load user custom part
21
22        // 1. set directory for acme package. It is relative to the dojo directory
23        dojo.hostenv.setModulePrefix('acme', 'tests/widget/acme');
24        dojo.widget.manager.registerWidgetPackage('acme');
25
26        // 2. load the user defined part
27        dojo.require("acme.TestColourPaletteDialogPart");
28
29        dojo.hostenv.writeIncludes();
30
31</script>
32
33<h1>An example of a Part.</h1>
34<p>A part allows you to have widgets within your template code.</p> 
35<p>A part is a way of putting a bunch of widgets together into something that
36is reusable, and which keeps all the related code together (just like a widget, but bigger.).
37A part descendent can also be used just like you would define a Form in most visual languages: but the layout is defined in the template and the form code is defined in the descendent class.
38In Delphi-speak: it is similar to a TForm or TFrame descendent.  Parts will normally be user defined.</p>
39<p>Warning: currently you cannot have a widget as the first element in a part template - something to do with parsing that I don't understand. Just make your first element a plain &lt;div&gt; and your template should work sweetly.
40<p id="foocolour"> In this test it is a custom colour palette dialog which is used to select the color of this paragraph.</p>
41
42<!-- the part! -->
43<div dojoType="TestColourPaletteDialogPart" updateId="foo"></div>
44
45<p>Things the test checks:</p>
46<ol>
47<li>widgets within widgets work</li>
48<li>dojoAttachWidget always attachs the widget to the part, even if the widget is a child of a container.</li>
49<li>dojoAttachPoint always attachs a DOM node to the part, even if the node is a child of a widget.</li>
50<li>dojoAttachEvent always attachs a DOM event to the part.</li>
51</ol>
52<p>Things we should test for:</p>
53<ol>
54<li>dojoAttachPoint, dojoAttachEvent, dojoAttachWidget should be ignored for 'contained' child nodes of the part (is implemented, not tested here).</li>
55<li>dojoAttachEvent on a widget gives a debug message (since it makes no sense and would be a common mistake!)  (is implemented, not tested here).</li>
56<li>Recursive template definitions are detected and an error is thrown. (is implemented, not tested here)</li>
57<li>What happens if you have a part that has a template that includes a part? Should work but not tested.</li>
58<li>A widget should be able to be the first element in a template (doesnt work at present).</li>
59</ol>