|
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 query with empty conditions |
|
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 <label step="3" id="http://www.some-fictitious-zoo.com/mammals/zebra" value="Zebra"/> |
|
19 <label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/> |
|
20 <label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/> |
|
21 <label step="-4" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/> |
|
22 <label step="2" id="http://www.some-fictitious-zoo.com/mammals/koala" value="Koala"/> |
|
23 <label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/> |
|
24 <label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/> |
|
25 <label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/> |
|
26 <label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/> |
|
27 <label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/> |
|
28 <label step="1" id="http://www.some-fictitious-zoo.com/mammals/arctichare" value="Arctic Hare"/> |
|
29 <label step="5" id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/> |
|
30 </data> |
|
31 |
|
32 <script src="templates_shared.js"/> |
|
33 |
|
34 <script> |
|
35 <![CDATA[ |
|
36 SimpleTest.waitForExplicitFinish(); |
|
37 |
|
38 var testid ="query with empty conditions"; |
|
39 var queryType = "rdf"; |
|
40 var isTreeBuilder = false; |
|
41 var needsOpen = false; |
|
42 var notWorkingYet = false; |
|
43 var notWorkingYetDynamic = false; |
|
44 var expectedOutput = document.getElementById("output"); |
|
45 |
|
46 var changes = [ |
|
47 // step 1 |
|
48 function(targetds, root) { |
|
49 var newnode = RDF.GetResource(ZOO_NS + 'mammals/arctichare'); |
|
50 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
51 RDF.GetLiteral('Arctic Hare'), true); |
|
52 var container = ContainerUtils.MakeSeq(targetds, |
|
53 RDF.GetResource(ZOO_NS + 'mammals')); |
|
54 container.AppendElement(newnode); |
|
55 }, |
|
56 // step 2 |
|
57 function(targetds, root) { |
|
58 var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala'); |
|
59 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
60 RDF.GetLiteral('Koala'), true); |
|
61 var container = ContainerUtils.MakeSeq(targetds, |
|
62 RDF.GetResource(ZOO_NS + 'mammals')); |
|
63 container.InsertElementAt(newnode, '4', true); |
|
64 }, |
|
65 // step 3 |
|
66 function(targetds, root) { |
|
67 var newnode = RDF.GetResource(ZOO_NS + 'mammals/zebra'); |
|
68 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
69 RDF.GetLiteral('Zebra'), true); |
|
70 var container = ContainerUtils.MakeSeq(targetds, |
|
71 RDF.GetResource(ZOO_NS + 'mammals')); |
|
72 container.InsertElementAt(newnode, '1', true); |
|
73 }, |
|
74 // step 4 |
|
75 function(targetds, root) { |
|
76 var container = ContainerUtils.MakeSeq(targetds, |
|
77 RDF.GetResource(ZOO_NS + 'mammals')); |
|
78 var removednode = container.RemoveElementAt('4', true); |
|
79 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
80 RDF.GetLiteral('African Elephant'), true); |
|
81 }, |
|
82 // step 5 |
|
83 function(targetds, root) { |
|
84 var newnode = RDF.GetResource(ZOO_NS + 'mammals/africanelephant'); |
|
85 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
86 RDF.GetLiteral('African Elephant'), true); |
|
87 var container = ContainerUtils.MakeSeq(targetds, |
|
88 RDF.GetResource(ZOO_NS + 'mammals')); |
|
89 container.AppendElement(newnode); |
|
90 }, |
|
91 // step 6 |
|
92 function(targetds, root) { |
|
93 targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/koala'), |
|
94 RDF.GetResource(ZOO_NS + 'rdf#specimensAsString'), |
|
95 RDF.GetLiteral('8'), 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/mammals"> |
|
102 <template id="template"> |
|
103 <query id="query"> |
|
104 <content uri="?uri"/> |
|
105 <member container="?uri" child="?animal"/> |
|
106 <triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/> |
|
107 </query> |
|
108 <rule> |
|
109 <conditions id="conditions"/> |
|
110 <action id="action"> |
|
111 <label uri="?animal" value="?name"/> |
|
112 </action> |
|
113 </rule> |
|
114 </template> |
|
115 </vbox> |
|
116 |
|
117 </window> |