|
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 simple syntax using recursive generation |
|
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 <hbox id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false"> |
|
19 <label value="Arachnids"/> |
|
20 <hbox id="http://www.some-fictitious-zoo.com/arachnids/tarantula"> |
|
21 <label value="Tarantula"/> |
|
22 </hbox> |
|
23 </hbox> |
|
24 <hbox id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false"> |
|
25 <label value="Birds"/> |
|
26 <hbox step="3" id="http://www.some-fictitious-zoo.com/birds/wren"> |
|
27 <label value="Wren"/> |
|
28 </hbox> |
|
29 <hbox id="http://www.some-fictitious-zoo.com/birds/emu"> |
|
30 <label value="Emu"/> |
|
31 </hbox> |
|
32 <hbox step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl"> |
|
33 <label value="Barn Owl"/> |
|
34 </hbox> |
|
35 <hbox id="http://www.some-fictitious-zoo.com/birds/raven"> |
|
36 <label value="Raven"/> |
|
37 </hbox> |
|
38 <hbox step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx"> |
|
39 <label value="Archaeopteryx"/> |
|
40 </hbox> |
|
41 <hbox step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin"> |
|
42 <label value="Emperor Penguin"/> |
|
43 </hbox> |
|
44 </hbox> |
|
45 </data> |
|
46 |
|
47 <script src="templates_shared.js"/> |
|
48 |
|
49 <script> |
|
50 <![CDATA[ |
|
51 SimpleTest.waitForExplicitFinish(); |
|
52 |
|
53 var testid ="simple syntax using recursive generation"; |
|
54 var queryType = "rdf"; |
|
55 var isTreeBuilder = false; |
|
56 var needsOpen = false; |
|
57 var notWorkingYet = false; |
|
58 var notWorkingYetDynamic = false; |
|
59 var expectedOutput = document.getElementById("output"); |
|
60 |
|
61 var changes = [ |
|
62 // step 1 |
|
63 function(targetds, root) { |
|
64 var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin'); |
|
65 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
66 RDF.GetLiteral('Emperor Penguin'), true); |
|
67 var container = ContainerUtils.MakeSeq(targetds, |
|
68 RDF.GetResource(ZOO_NS + 'birds')); |
|
69 container.AppendElement(newnode); |
|
70 }, |
|
71 // step 2 |
|
72 function(targetds, root) { |
|
73 var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx'); |
|
74 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
75 RDF.GetLiteral('Archaeopteryx'), true); |
|
76 var container = ContainerUtils.MakeSeq(targetds, |
|
77 RDF.GetResource(ZOO_NS + 'birds')); |
|
78 container.InsertElementAt(newnode, '4', true); |
|
79 }, |
|
80 // step 3 |
|
81 function(targetds, root) { |
|
82 var newnode = RDF.GetResource(ZOO_NS + 'birds/wren'); |
|
83 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
84 RDF.GetLiteral('Wren'), true); |
|
85 var container = ContainerUtils.MakeSeq(targetds, |
|
86 RDF.GetResource(ZOO_NS + 'birds')); |
|
87 container.InsertElementAt(newnode, '1', true); |
|
88 }, |
|
89 // step 4 |
|
90 function(targetds, root) { |
|
91 var container = ContainerUtils.MakeSeq(targetds, |
|
92 RDF.GetResource(ZOO_NS + 'birds')); |
|
93 var removednode = container.RemoveElementAt('3', true); |
|
94 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
95 RDF.GetLiteral('Barn Owl'), true); |
|
96 } |
|
97 ]; |
|
98 ]]> |
|
99 </script> |
|
100 |
|
101 <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/some-animals"> |
|
102 <template id="template"> |
|
103 <hbox uri="rdf:*"> |
|
104 <label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/> |
|
105 </hbox> |
|
106 </template> |
|
107 </vbox> |
|
108 |
|
109 </window> |