|
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 - query syntax not recursive |
|
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 id="http://www.some-fictitious-zoo.com/humans/sarah"> |
|
24 <treerow> |
|
25 <treecell label="Sarah"/> |
|
26 <treecell/> |
|
27 </treerow> |
|
28 </treeitem> |
|
29 <treeitem step="-1" id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false"> |
|
30 <treerow> |
|
31 <treecell label="Mammals"/> |
|
32 <treecell/> |
|
33 </treerow> |
|
34 </treeitem> |
|
35 <treeitem step="1" id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" open="true"> |
|
36 <treerow> |
|
37 <treecell label="Mammals"/> |
|
38 <treecell/> |
|
39 </treerow> |
|
40 </treeitem> |
|
41 <treeitem step="-4" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true"> |
|
42 <treerow> |
|
43 <treecell label="Crustaceans"/> |
|
44 <treecell/> |
|
45 </treerow> |
|
46 </treeitem> |
|
47 <treeitem step="4" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true"> |
|
48 <treerow> |
|
49 <treecell label="Crustaceans"/> |
|
50 <treecell/> |
|
51 </treerow> |
|
52 </treeitem> |
|
53 <treeitem id="http://www.some-fictitious-zoo.com/birds/emu"> |
|
54 <treerow> |
|
55 <treecell label="Emu"/> |
|
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 - query syntax not recursive"; |
|
69 var queryType = "rdf"; |
|
70 var isTreeBuilder = false; |
|
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 if (root.view && 1 < root.view.rowCount && root.view.isContainer(1)) |
|
80 root.view.toggleOpenState(1); |
|
81 }, |
|
82 // step 2 |
|
83 function(targetds, root) { |
|
84 var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala'); |
|
85 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
86 RDF.GetLiteral('Koala'), true); |
|
87 var container = ContainerUtils.MakeSeq(targetds, |
|
88 RDF.GetResource(ZOO_NS + 'mammals')); |
|
89 container.InsertElementAt(newnode, '4', true); |
|
90 }, |
|
91 // step 3 |
|
92 function(targetds, root) { |
|
93 var newnode = RDF.GetResource(ZOO_NS + 'crustaceans/lobster'); |
|
94 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
95 RDF.GetLiteral('Lobster'), true); |
|
96 var container = ContainerUtils.MakeSeq(targetds, |
|
97 RDF.GetResource(ZOO_NS + 'crustaceans')); |
|
98 container.AppendElement(newnode); |
|
99 }, |
|
100 // step 4 |
|
101 function(targetds, root) { |
|
102 if (root.view && 11 < root.view.rowCount && root.view.isContainer(11)) |
|
103 root.view.toggleOpenState(11); |
|
104 }, |
|
105 // step 5 |
|
106 function(targetds, root) { |
|
107 if (root.view && 11 < root.view.rowCount && root.view.isContainer(11)) |
|
108 root.view.toggleOpenState(11); |
|
109 }, |
|
110 // step 6 |
|
111 function(targetds, root) { |
|
112 if (root.view && 1 < root.view.rowCount && root.view.isContainer(1)) |
|
113 root.view.toggleOpenState(1); |
|
114 } |
|
115 ]; |
|
116 ]]> |
|
117 </script> |
|
118 |
|
119 <tree xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" hidevscroll="true" hidehscroll="true" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/marked" flags="dont-recurse" id="root"> |
|
120 <treecols orient="horizontal" id="treecols"> |
|
121 <treecol id="treecol" primary="true" label="Name"/> |
|
122 <treecol label="Species"/> |
|
123 </treecols> |
|
124 <template id="template"> |
|
125 <query> |
|
126 <content uri="?uri"/> |
|
127 <member container="?uri" child="?child"/> |
|
128 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/> |
|
129 </query> |
|
130 <rule> |
|
131 <action> |
|
132 <treechildren> |
|
133 <treeitem uri="?child"> |
|
134 <treerow> |
|
135 <treecell label="?name"/> |
|
136 <treecell/> |
|
137 </treerow> |
|
138 </treeitem> |
|
139 </treechildren> |
|
140 </action> |
|
141 </rule> |
|
142 </template> |
|
143 </tree> |
|
144 |
|
145 </window> |