content/xul/templates/tests/chrome/test_tmpl_wherecontainstwo.xul

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

mercurial