|
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 - extended syntax with binding |
|
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:div id="http://www.some-fictitious-zoo.com/mammals/lion" title="Lion"> |
|
19 <html:em step="-2">4</html:em> |
|
20 <html:em step="2">9</html:em> |
|
21 </html:div> |
|
22 <html:div id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" title="HIPPOPOTAMUS"> |
|
23 <html:em>2</html:em> |
|
24 </html:div> |
|
25 <html:p id="http://www.some-fictitious-zoo.com/mammals/africanelephant"> |
|
26 African Elephant |
|
27 <html:span title="14"/> |
|
28 </html:p> |
|
29 <html:p step="4" id="http://www.some-fictitious-zoo.com/mammals/chimpanzee"> |
|
30 Chimpanzee |
|
31 <html:span step="-5"/> |
|
32 <html:span step="5" title="3"/> |
|
33 </html:p> |
|
34 <html:div id="http://www.some-fictitious-zoo.com/mammals/llama" title="LLAMA"> |
|
35 <html:em>5</html:em> |
|
36 </html:div> |
|
37 <html:div id="http://www.some-fictitious-zoo.com/mammals/polarbear" title="Polar Bear"> |
|
38 <html:em step="-1">20</html:em> |
|
39 <html:em step="1">5</html:em> |
|
40 </html:div> |
|
41 <html:div id="http://www.some-fictitious-zoo.com/mammals/aardvark" title="aardvark"> |
|
42 <html:em>2</html:em> |
|
43 </html:div> |
|
44 <html:p step="-3" id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo"> |
|
45 Nine-banded Armadillo |
|
46 <html:span title="1"/> |
|
47 </html:p> |
|
48 <html:div id="http://www.some-fictitious-zoo.com/mammals/gorilla" title="Gorilla"> |
|
49 <html:em>7</html:em> |
|
50 </html:div> |
|
51 </data> |
|
52 |
|
53 <script src="templates_shared.js"/> |
|
54 |
|
55 <script> |
|
56 <![CDATA[ |
|
57 SimpleTest.waitForExplicitFinish(); |
|
58 |
|
59 var testid ="html element - extended syntax with binding"; |
|
60 var queryType = "rdf"; |
|
61 var isTreeBuilder = false; |
|
62 var needsOpen = false; |
|
63 var notWorkingYet = false; |
|
64 var notWorkingYetDynamic = false; |
|
65 var expectedOutput = document.getElementById("output"); |
|
66 |
|
67 var changes = [ |
|
68 // step 1 |
|
69 function(targetds, root) { |
|
70 var subject = RDF.GetResource(ZOO_NS + 'mammals/polarbear'); |
|
71 var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens'); |
|
72 var oldval = targetds.GetTarget(subject, predicate, true); |
|
73 targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/polarbear'), |
|
74 RDF.GetResource(ZOO_NS + 'rdf#specimens'), |
|
75 oldval, RDF.GetLiteral('5')); |
|
76 }, |
|
77 // step 2 |
|
78 function(targetds, root) { |
|
79 var subject = RDF.GetResource(ZOO_NS + 'mammals/lion'); |
|
80 var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens'); |
|
81 var oldval = targetds.GetTarget(subject, predicate, true); |
|
82 targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/lion'), |
|
83 RDF.GetResource(ZOO_NS + 'rdf#specimens'), |
|
84 oldval, RDF.GetLiteral('9')); |
|
85 }, |
|
86 // step 3 |
|
87 function(targetds, root) { |
|
88 var container = ContainerUtils.MakeSeq(targetds, |
|
89 RDF.GetResource(ZOO_NS + 'mammals')); |
|
90 var removednode = container.RemoveElementAt('7', true); |
|
91 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
92 RDF.GetLiteral('Nine-banded Armadillo'), true); |
|
93 }, |
|
94 // step 4 |
|
95 function(targetds, root) { |
|
96 var newnode = RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'); |
|
97 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
|
98 RDF.GetLiteral('Chimpanzee'), true); |
|
99 var container = ContainerUtils.MakeSeq(targetds, |
|
100 RDF.GetResource(ZOO_NS + 'mammals')); |
|
101 container.InsertElementAt(newnode, '4', true); |
|
102 }, |
|
103 // step 5 |
|
104 function(targetds, root) { |
|
105 targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'), |
|
106 RDF.GetResource(ZOO_NS + 'rdf#specimens'), |
|
107 RDF.GetLiteral('3'), true); |
|
108 } |
|
109 ]; |
|
110 ]]> |
|
111 </script> |
|
112 |
|
113 <div xmlns="http://www.w3.org/1999/xhtml" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/mammals"><template xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="template"><rule><conditions><content uri="?uri"/><member container="?uri" child="?animal"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/><where subject="?name" rel="contains" value="an"/></conditions><bindings><binding subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/></bindings><action><p xmlns="http://www.w3.org/1999/xhtml" uri="?animal"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?name"/><span title="?specimens"/></p></action></rule><rule><conditions><content uri="?uri"/><member container="?uri" child="?animal"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/></conditions><bindings><binding subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/></bindings><action><div xmlns="http://www.w3.org/1999/xhtml" uri="?animal" title="?name"><em><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?specimens"/></em></div></action></rule></template></div> |
|
114 </window> |