|
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 grid element |
|
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 <columns> |
|
19 <column/> |
|
20 <column/> |
|
21 </columns> |
|
22 <rows> |
|
23 <label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="The coolest animal is: Wren"/> |
|
24 <row id="http://www.some-fictitious-zoo.com/birds/emu"> |
|
25 <label value="Emu"/> |
|
26 <label value="Birds"/> |
|
27 </row> |
|
28 <label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="The coolest animal is: Barn Owl"/> |
|
29 <row id="http://www.some-fictitious-zoo.com/birds/raven"> |
|
30 <label value="Raven"/> |
|
31 <label value="Birds"/> |
|
32 </row> |
|
33 <row step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx"> |
|
34 <label value="Archaeopteryx"/> |
|
35 <label value="Birds"/> |
|
36 </row> |
|
37 <label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="The coolest animal is: Emperor Penguin"/> |
|
38 </rows> |
|
39 </data> |
|
40 |
|
41 <script src="templates_shared.js"/> |
|
42 |
|
43 <script> |
|
44 <![CDATA[ |
|
45 SimpleTest.waitForExplicitFinish(); |
|
46 |
|
47 var testid ="grid element"; |
|
48 var queryType = "rdf"; |
|
49 var isTreeBuilder = false; |
|
50 var needsOpen = false; |
|
51 var notWorkingYet = false; |
|
52 var notWorkingYetDynamic = false; |
|
53 var expectedOutput = document.getElementById("output"); |
|
54 |
|
55 var changes = [ |
|
56 // step 1 |
|
57 function(targetds, root) { |
|
58 var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin'); |
|
59 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
60 RDF.GetLiteral('Emperor Penguin'), true); |
|
61 var container = ContainerUtils.MakeSeq(targetds, |
|
62 RDF.GetResource(ZOO_NS + 'birds')); |
|
63 container.AppendElement(newnode); |
|
64 }, |
|
65 // step 2 |
|
66 function(targetds, root) { |
|
67 var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx'); |
|
68 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
69 RDF.GetLiteral('Archaeopteryx'), true); |
|
70 var container = ContainerUtils.MakeSeq(targetds, |
|
71 RDF.GetResource(ZOO_NS + 'birds')); |
|
72 container.InsertElementAt(newnode, '4', true); |
|
73 }, |
|
74 // step 3 |
|
75 function(targetds, root) { |
|
76 var newnode = RDF.GetResource(ZOO_NS + 'birds/wren'); |
|
77 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
78 RDF.GetLiteral('Wren'), true); |
|
79 var container = ContainerUtils.MakeSeq(targetds, |
|
80 RDF.GetResource(ZOO_NS + 'birds')); |
|
81 container.InsertElementAt(newnode, '1', true); |
|
82 }, |
|
83 // step 4 |
|
84 function(targetds, root) { |
|
85 var container = ContainerUtils.MakeSeq(targetds, |
|
86 RDF.GetResource(ZOO_NS + 'birds')); |
|
87 var removednode = container.RemoveElementAt('3', true); |
|
88 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
89 RDF.GetLiteral('Barn Owl'), true); |
|
90 } |
|
91 ]; |
|
92 ]]> |
|
93 </script> |
|
94 |
|
95 <grid xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/birds"> |
|
96 <columns> |
|
97 <column/> |
|
98 <column/> |
|
99 </columns> |
|
100 <template> |
|
101 <query> |
|
102 <content uri="?uri"/> |
|
103 <member container="?uri" child="?child"/> |
|
104 <triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?classname"/> |
|
105 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/> |
|
106 </query> |
|
107 <rule> |
|
108 <conditions> |
|
109 <where subject="?name" rel="equals" value="Raven" negate="true"/> |
|
110 <where subject="?name" rel="contains" value="n"/> |
|
111 </conditions> |
|
112 <action> |
|
113 <rows> |
|
114 <label uri="?child" value="The coolest animal is: ?name"/> |
|
115 </rows> |
|
116 </action> |
|
117 </rule> |
|
118 <rule> |
|
119 <action> |
|
120 <rows> |
|
121 <row uri="?child"> |
|
122 <label value="?name"/> |
|
123 <label value="?classname"/> |
|
124 </row> |
|
125 </rows> |
|
126 </action> |
|
127 </rule> |
|
128 </template> |
|
129 </grid> |
|
130 |
|
131 </window> |