content/xul/templates/tests/chrome/test_tmpl_treeelementtreecelltreebuilder.xul

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:4b0a3ddb5c3d
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4
5 <!--
6 tree element - treecell tree builder
7 -->
8
9 <window title="XUL Template Tests" width="500" height="600"
10 onload="test_template();"
11 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
12 <script type="application/javascript"
13 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
14
15 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
16
17 <data id="output">
18 <treecols id="treecols" orient="horizontal">
19 <treecol id="treecol" primary="true" label="Name" ordinal="1"/>
20 <treecol label="Species" ordinal="3"/>
21 </treecols>
22 <treechildren>
23 <treeitem step="3" id="http://www.some-fictitious-zoo.com/birds/wren">
24 <treerow>
25 <treecell label="Wren"/>
26 <treecell/>
27 </treerow>
28 </treeitem>
29 <treeitem id="http://www.some-fictitious-zoo.com/birds/emu">
30 <treerow>
31 <treecell label="Emu"/>
32 <treecell label="Dromaius novaehollandiae"/>
33 </treerow>
34 </treeitem>
35 <treeitem step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl">
36 <treerow>
37 <treecell label="Barn Owl"/>
38 <treecell label="Tyto alba"/>
39 </treerow>
40 </treeitem>
41 <treeitem id="http://www.some-fictitious-zoo.com/birds/raven">
42 <treerow>
43 <treecell label="Raven"/>
44 <treecell label="Corvus corax"/>
45 </treerow>
46 </treeitem>
47 <treeitem step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
48 <treerow>
49 <treecell label="Archaeopteryx"/>
50 <treecell/>
51 </treerow>
52 </treeitem>
53 <treeitem step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin">
54 <treerow>
55 <treecell label="Emperor Penguin"/>
56 <treecell/>
57 </treerow>
58 </treeitem>
59 </treechildren>
60 </data>
61
62 <script src="templates_shared.js"/>
63
64 <script>
65 <![CDATA[
66 SimpleTest.waitForExplicitFinish();
67
68 var testid ="tree element - treecell tree builder";
69 var queryType = "rdf";
70 var isTreeBuilder = true;
71 var needsOpen = false;
72 var notWorkingYet = false;
73 var notWorkingYetDynamic = true;
74 var expectedOutput = document.getElementById("output");
75
76 var changes = [
77 // step 1
78 function(targetds, root) {
79 var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
80 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
81 RDF.GetLiteral('Emperor Penguin'), true);
82 var container = ContainerUtils.MakeSeq(targetds,
83 RDF.GetResource(ZOO_NS + 'birds'));
84 container.AppendElement(newnode);
85 },
86 // step 2
87 function(targetds, root) {
88 var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
89 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
90 RDF.GetLiteral('Archaeopteryx'), true);
91 var container = ContainerUtils.MakeSeq(targetds,
92 RDF.GetResource(ZOO_NS + 'birds'));
93 container.InsertElementAt(newnode, '4', true);
94 },
95 // step 3
96 function(targetds, root) {
97 var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
98 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
99 RDF.GetLiteral('Wren'), true);
100 var container = ContainerUtils.MakeSeq(targetds,
101 RDF.GetResource(ZOO_NS + 'birds'));
102 container.InsertElementAt(newnode, '1', true);
103 },
104 // step 4
105 function(targetds, root) {
106 var container = ContainerUtils.MakeSeq(targetds,
107 RDF.GetResource(ZOO_NS + 'birds'));
108 var removednode = container.RemoveElementAt('3', true);
109 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
110 RDF.GetLiteral('Barn Owl'), true);
111 }
112 ];
113 ]]>
114 </script>
115
116 <tree xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" hidevscroll="true" hidehscroll="true" datasources="rdf:null" flags="dont-build-content" id="root" ref="http://www.some-fictitious-zoo.com/birds">
117 <treecols orient="horizontal" id="treecols">
118 <treecol id="treecol" primary="true" label="Name" ordinal="1"/>
119 <treecol label="Species" ordinal="3"/>
120 </treecols>
121 <template id="template">
122 <treechildren id="treechildren">
123 <treeitem uri="rdf:*">
124 <treerow>
125 <treecell label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
126 <treecell label="rdf:http://www.some-fictitious-zoo.com/rdf#species"/>
127 </treerow>
128 </treeitem>
129 </treechildren>
130 </template>
131 </tree>
132
133 </window>

mercurial