1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/templates/tests/chrome/test_tmpl_htmlelementquerysyntaxwithmultiplerules.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,102 @@ 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 - query syntax with multiple rules 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:span step="-2" id="http://www.some-fictitious-zoo.com/mammals/lion">Lion</html:span> 1.22 + <html:span id="http://www.some-fictitious-zoo.com/mammals/hippopotamus">HIPPOPOTAMUS</html:span> 1.23 + <vbox> 1.24 + <html:p step="2" id="http://www.some-fictitious-zoo.com/mammals/lion"> 1.25 + <html:span title="Lion"/> 1.26 + </html:p> 1.27 + <html:p id="http://www.some-fictitious-zoo.com/mammals/africanelephant"> 1.28 + <html:span title="African Elephant"/> 1.29 + </html:p> 1.30 + <html:p step="-1" id="http://www.some-fictitious-zoo.com/mammals/polarbear"> 1.31 + <html:span title="Polar Bear"/> 1.32 + </html:p> 1.33 + <html:p id="http://www.some-fictitious-zoo.com/mammals/gorilla"> 1.34 + <html:span title="Gorilla"/> 1.35 + </html:p> 1.36 + </vbox> 1.37 + <html:span step="5" id="http://www.some-fictitious-zoo.com/mammals/chimpanzee">Chimpanzee</html:span> 1.38 + <html:span id="http://www.some-fictitious-zoo.com/mammals/llama">LLAMA</html:span> 1.39 + <html:span step="1" id="http://www.some-fictitious-zoo.com/mammals/polarbear">Polar Bear</html:span> 1.40 + <html:span id="http://www.some-fictitious-zoo.com/mammals/aardvark">aardvark</html:span> 1.41 + <html:span step="-3" id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">Nine-banded Armadillo</html:span> 1.42 + </data> 1.43 + 1.44 +<script src="templates_shared.js"/> 1.45 + 1.46 +<script> 1.47 +<![CDATA[ 1.48 +SimpleTest.waitForExplicitFinish(); 1.49 + 1.50 +var testid ="html element - query syntax with multiple rules"; 1.51 +var queryType = "rdf"; 1.52 +var isTreeBuilder = false; 1.53 +var needsOpen = false; 1.54 +var notWorkingYet = true; 1.55 +var notWorkingYetDynamic = true; 1.56 +var expectedOutput = document.getElementById("output"); 1.57 + 1.58 +var changes = [ 1.59 + // step 1 1.60 + function(targetds, root) { 1.61 + var subject = RDF.GetResource(ZOO_NS + 'mammals/polarbear'); 1.62 + var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens'); 1.63 + var oldval = targetds.GetTarget(subject, predicate, true); 1.64 + targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/polarbear'), 1.65 + RDF.GetResource(ZOO_NS + 'rdf#specimens'), 1.66 + oldval, RDF.GetLiteral('5')); 1.67 + }, 1.68 + // step 2 1.69 + function(targetds, root) { 1.70 + var subject = RDF.GetResource(ZOO_NS + 'mammals/lion'); 1.71 + var predicate = RDF.GetResource(ZOO_NS + 'rdf#specimens'); 1.72 + var oldval = targetds.GetTarget(subject, predicate, true); 1.73 + targetds.Change(RDF.GetResource(ZOO_NS + 'mammals/lion'), 1.74 + RDF.GetResource(ZOO_NS + 'rdf#specimens'), 1.75 + oldval, RDF.GetLiteral('9')); 1.76 + }, 1.77 + // step 3 1.78 + function(targetds, root) { 1.79 + var container = ContainerUtils.MakeSeq(targetds, 1.80 + RDF.GetResource(ZOO_NS + 'mammals')); 1.81 + var removednode = container.RemoveElementAt('7', true); 1.82 + targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.83 + RDF.GetLiteral('Nine-banded Armadillo'), true); 1.84 + }, 1.85 + // step 4 1.86 + function(targetds, root) { 1.87 + var newnode = RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'); 1.88 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.89 + RDF.GetLiteral('Chimpanzee'), true); 1.90 + var container = ContainerUtils.MakeSeq(targetds, 1.91 + RDF.GetResource(ZOO_NS + 'mammals')); 1.92 + container.InsertElementAt(newnode, '4', true); 1.93 + }, 1.94 + // step 5 1.95 + function(targetds, root) { 1.96 + targetds.Assert(RDF.GetResource(ZOO_NS + 'mammals/chimpanzee'), 1.97 + RDF.GetResource(ZOO_NS + 'rdf#specimens'), 1.98 + RDF.GetLiteral('3'), true); 1.99 + } 1.100 +]; 1.101 +]]> 1.102 +</script> 1.103 + 1.104 +<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"><query><content uri="?uri"/><member container="?uri" child="?animal"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/><triple subject="?animal" predicate="http://www.some-fictitious-zoo.com/rdf#specimens" object="?specimens"/></query><rule><conditions id="conditions"><where subject="?specimens" rel="greater" value="6"/></conditions><action><vbox><p xmlns="http://www.w3.org/1999/xhtml" uri="?animal"><span title="?name"/></p></vbox></action></rule><rule><action><span xmlns="http://www.w3.org/1999/xhtml" uri="?animal"><textnode xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" value="?name"/></span></action></rule></template></div> 1.105 +</window>