|
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 html element - query syntax recursive |
|
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" xmlns:html="http://www.w3.org/1999/xhtml"> |
|
18 <html:strong id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false">Arachnids</html:strong> |
|
19 <html:strong step="-3" id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false"> |
|
20 Birds |
|
21 <html:span id="http://www.some-fictitious-zoo.com/birds/barnowl">Barn Owl</html:span> |
|
22 </html:strong> |
|
23 <html:strong step="1" id="http://www.some-fictitious-zoo.com/insects">Insects</html:strong> |
|
24 <html:strong id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false"> |
|
25 Mammals |
|
26 <html:span id="http://www.some-fictitious-zoo.com/mammals/lion">Lion</html:span> |
|
27 <html:span id="http://www.some-fictitious-zoo.com/mammals/hippopotamus">HIPPOPOTAMUS</html:span> |
|
28 <html:span step="2" id="http://www.some-fictitious-zoo.com/mammals/koala">Koala</html:span> |
|
29 <html:span id="http://www.some-fictitious-zoo.com/mammals/polarbear">Polar Bear</html:span> |
|
30 <html:span id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">Nine-banded Armadillo</html:span> |
|
31 <html:span id="http://www.some-fictitious-zoo.com/mammals/gorilla">Gorilla</html:span> |
|
32 </html:strong> |
|
33 </data> |
|
34 |
|
35 <script src="templates_shared.js"/> |
|
36 |
|
37 <script> |
|
38 <![CDATA[ |
|
39 SimpleTest.waitForExplicitFinish(); |
|
40 |
|
41 var testid ="html element - query syntax recursive"; |
|
42 var queryType = "rdf"; |
|
43 var isTreeBuilder = false; |
|
44 var needsOpen = false; |
|
45 var notWorkingYet = false; |
|
46 var notWorkingYetDynamic = false; |
|
47 var expectedOutput = document.getElementById("output"); |
|
48 |
|
49 var changes = [ |
|
50 // step 1 |
|
51 function(targetds, root) { |
|
52 var newnode = RDF.GetResource(ZOO_NS + 'insects'); |
|
53 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
54 RDF.GetLiteral('Insects'), true); |
|
55 var container = ContainerUtils.MakeSeq(targetds, |
|
56 RDF.GetResource(ZOO_NS + 'all-animals')); |
|
57 container.InsertElementAt(newnode, '3', true); |
|
58 }, |
|
59 // step 2 |
|
60 function(targetds, root) { |
|
61 var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala'); |
|
62 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
63 RDF.GetLiteral('Koala'), true); |
|
64 var container = ContainerUtils.MakeSeq(targetds, |
|
65 RDF.GetResource(ZOO_NS + 'mammals')); |
|
66 container.InsertElementAt(newnode, '4', true); |
|
67 }, |
|
68 // step 3 |
|
69 function(targetds, root) { |
|
70 var container = ContainerUtils.MakeSeq(targetds, |
|
71 RDF.GetResource(ZOO_NS + 'all-animals')); |
|
72 var removednode = container.RemoveElementAt('2', true); |
|
73 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
74 RDF.GetLiteral('Birds'), true); |
|
75 } |
|
76 ]; |
|
77 ]]> |
|
78 </script> |
|
79 |
|
80 <div xmlns="http://www.w3.org/1999/xhtml" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/all-animals"><template xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="template"><query><content uri="?uri"/><member container="?uri" child="?child"/><triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/></query><rule><conditions><where subject="?name" rel="endswith" multiple="true" value="mals,ects,nids,irds"/></conditions><action><strong xmlns="http://www.w3.org/1999/xhtml" uri="?child"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?name"/></strong></action></rule><rule><conditions><where subject="?uri" rel="equals" negate="true" value="http://www.some-fictitious-zoo.com/all-animals"/><where subject="?name" rel="contains" ignorecase="true" value="o"/></conditions><action><span xmlns="http://www.w3.org/1999/xhtml" uri="?child"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?name"/></span></action></rule></template></div> |
|
81 </window> |