content/xul/templates/tests/chrome/test_tmpl_querytwomembers.xul

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:53798a8429cd
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 - two members
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" unordered="true">
18 <label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/>
19 <label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="Wren"/>
20 <label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/>
21 <label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/>
22 <label id="http://www.some-fictitious-zoo.com/birds/raven" value="Raven"/>
23 <label step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" value="Archaeopteryx"/>
24 <label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="Emperor Penguin"/>
25 <label id="http://www.some-fictitious-zoo.com/fish/cod" value="Cod"/>
26 <label id="http://www.some-fictitious-zoo.com/fish/swordfish" value="Swordfish"/>
27 <label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/>
28 <label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/>
29 <label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/>
30 <label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/>
31 <label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/>
32 <label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/>
33 <label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/>
34 <label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/>
35 <label id="http://www.some-fictitious-zoo.com/reptiles/anaconda" value="Anaconda"/>
36 <label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Chameleon"/>
37 </data>
38
39 <script src="templates_shared.js"/>
40
41 <script>
42 <![CDATA[
43 SimpleTest.waitForExplicitFinish();
44
45 var testid ="query - two members";
46 var queryType = "rdf";
47 var isTreeBuilder = false;
48 var needsOpen = false;
49 var notWorkingYet = false;
50 var notWorkingYetDynamic = false;
51 var expectedOutput = document.getElementById("output");
52
53 var changes = [
54 // step 1
55 function(targetds, root) {
56 var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
57 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
58 RDF.GetLiteral('Emperor Penguin'), true);
59 var container = ContainerUtils.MakeSeq(targetds,
60 RDF.GetResource(ZOO_NS + 'birds'));
61 container.AppendElement(newnode);
62 },
63 // step 2
64 function(targetds, root) {
65 var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
66 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
67 RDF.GetLiteral('Archaeopteryx'), true);
68 var container = ContainerUtils.MakeSeq(targetds,
69 RDF.GetResource(ZOO_NS + 'birds'));
70 container.InsertElementAt(newnode, '4', true);
71 },
72 // step 3
73 function(targetds, root) {
74 var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
75 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
76 RDF.GetLiteral('Wren'), true);
77 var container = ContainerUtils.MakeSeq(targetds,
78 RDF.GetResource(ZOO_NS + 'birds'));
79 container.InsertElementAt(newnode, '1', true);
80 },
81 // step 4
82 function(targetds, root) {
83 var container = ContainerUtils.MakeSeq(targetds,
84 RDF.GetResource(ZOO_NS + 'birds'));
85 var removednode = container.RemoveElementAt('3', true);
86 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
87 RDF.GetLiteral('Barn Owl'), true);
88 }
89 ];
90 ]]>
91 </script>
92
93 <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/all-animals">
94 <template id="template">
95 <query id="query">
96 <content uri="?uri"/>
97 <member container="?uri" child="?childone"/>
98 <member container="?childone" child="?child"/>
99 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
100 </query>
101 ,<action>
102 <label uri="?child" value="?name"/>
103 </action>
104 </template>
105 </vbox>
106
107 </window>

mercurial