1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/templates/tests/chrome/test_tmpl_htmlelementextendedsyntaxwithbinding.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,114 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> 1.7 + 1.8 +<!-- 1.9 + html element - extended syntax with binding 1.10 +--> 1.11 + 1.12 +<window title="XUL Template Tests" width="500" height="600" 1.13 + onload="test_template();" 1.14 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.15 + <script type="application/javascript" 1.16 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.17 + 1.18 + <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/> 1.19 + 1.20 + <data id="output" xmlns:html="http://www.w3.org/1999/xhtml"> 1.21 + <html:div id="http://www.some-fictitious-zoo.com/mammals/lion" title="Lion"> 1.22 + <html:em step="-2">4</html:em> 1.23 + <html:em step="2">9</html:em> 1.24 + </html:div> 1.25 + <html:div id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" title="HIPPOPOTAMUS"> 1.26 + <html:em>2</html:em> 1.27 + </html:div> 1.28 + <html:p id="http://www.some-fictitious-zoo.com/mammals/africanelephant"> 1.29 + African Elephant 1.30 + <html:span title="14"/> 1.31 + </html:p> 1.32 + <html:p step="4" id="http://www.some-fictitious-zoo.com/mammals/chimpanzee"> 1.33 + Chimpanzee 1.34 + <html:span step="-5"/> 1.35 + <html:span step="5" title="3"/> 1.36 + </html:p> 1.37 + <html:div id="http://www.some-fictitious-zoo.com/mammals/llama" title="LLAMA"> 1.38 + <html:em>5</html:em> 1.39 + </html:div> 1.40 + <html:div id="http://www.some-fictitious-zoo.com/mammals/polarbear" title="Polar Bear"> 1.41 + <html:em step="-1">20</html:em> 1.42 + <html:em step="1">5</html:em> 1.43 + </html:div> 1.44 + <html:div id="http://www.some-fictitious-zoo.com/mammals/aardvark" title="aardvark"> 1.45 + <html:em>2</html:em> 1.46 + </html:div> 1.47 + <html:p step="-3" id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo"> 1.48 + Nine-banded Armadillo 1.49 + <html:span title="1"/> 1.50 + </html:p> 1.51 + <html:div id="http://www.some-fictitious-zoo.com/mammals/gorilla" title="Gorilla"> 1.52 + <html:em>7</html:em> 1.53 + </html:div> 1.54 + </data> 1.55 + 1.56 +<script src="templates_shared.js"/> 1.57 + 1.58 +<script> 1.59 +<![CDATA[ 1.60 +SimpleTest.waitForExplicitFinish(); 1.61 + 1.62 +var testid ="html element - extended syntax with binding"; 1.63 +var queryType = "rdf"; 1.64 +var isTreeBuilder = false; 1.65 +var needsOpen = false; 1.66 +var notWorkingYet = false; 1.67 +var notWorkingYetDynamic = false; 1.68 +var expectedOutput = document.getElementById("output"); 1.69 + 1.70 +var changes = [ 1.71 + // step 1 1.72 + function(targetds, root) { 1.73 + var subject = RDF.GetResource(ZOO_NS + 'mammals/polarbear'); 1.74 + var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens'); 1.75 + var oldval = targetds.GetTarget(subject, predicate, true); 1.76 + targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/polarbear'), 1.77 + RDF.GetResource(ZOO_NS + 'rdf#specimens'), 1.78 + oldval, RDF.GetLiteral('5')); 1.79 + }, 1.80 + // step 2 1.81 + function(targetds, root) { 1.82 + var subject = RDF.GetResource(ZOO_NS + 'mammals/lion'); 1.83 + var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens'); 1.84 + var oldval = targetds.GetTarget(subject, predicate, true); 1.85 + targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/lion'), 1.86 + RDF.GetResource(ZOO_NS + 'rdf#specimens'), 1.87 + oldval, RDF.GetLiteral('9')); 1.88 + }, 1.89 + // step 3 1.90 + function(targetds, root) { 1.91 + var container = ContainerUtils.MakeSeq(targetds, 1.92 + RDF.GetResource(ZOO_NS + 'mammals')); 1.93 + var removednode = container.RemoveElementAt('7', true); 1.94 + targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.95 + RDF.GetLiteral('Nine-banded Armadillo'), true); 1.96 + }, 1.97 + // step 4 1.98 + function(targetds, root) { 1.99 + var newnode = RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'); 1.100 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.101 + RDF.GetLiteral('Chimpanzee'), true); 1.102 + var container = ContainerUtils.MakeSeq(targetds, 1.103 + RDF.GetResource(ZOO_NS + 'mammals')); 1.104 + container.InsertElementAt(newnode, '4', true); 1.105 + }, 1.106 + // step 5 1.107 + function(targetds, root) { 1.108 + targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'), 1.109 + RDF.GetResource(ZOO_NS + 'rdf#specimens'), 1.110 + RDF.GetLiteral('3'), true); 1.111 + } 1.112 +]; 1.113 +]]> 1.114 +</script> 1.115 + 1.116 +<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> 1.117 +</window>