1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/templates/tests/chrome/test_tmpl_htmlelementquerysyntaxrecursive.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,81 @@ 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 recursive 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:strong id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false">Arachnids</html:strong> 1.22 + <html:strong step="-3" id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false"> 1.23 + Birds 1.24 + <html:span id="http://www.some-fictitious-zoo.com/birds/barnowl">Barn Owl</html:span> 1.25 + </html:strong> 1.26 + <html:strong step="1" id="http://www.some-fictitious-zoo.com/insects">Insects</html:strong> 1.27 + <html:strong id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false"> 1.28 + Mammals 1.29 + <html:span id="http://www.some-fictitious-zoo.com/mammals/lion">Lion</html:span> 1.30 + <html:span id="http://www.some-fictitious-zoo.com/mammals/hippopotamus">HIPPOPOTAMUS</html:span> 1.31 + <html:span step="2" id="http://www.some-fictitious-zoo.com/mammals/koala">Koala</html:span> 1.32 + <html:span id="http://www.some-fictitious-zoo.com/mammals/polarbear">Polar Bear</html:span> 1.33 + <html:span id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo">Nine-banded Armadillo</html:span> 1.34 + <html:span id="http://www.some-fictitious-zoo.com/mammals/gorilla">Gorilla</html:span> 1.35 + </html:strong> 1.36 + </data> 1.37 + 1.38 +<script src="templates_shared.js"/> 1.39 + 1.40 +<script> 1.41 +<![CDATA[ 1.42 +SimpleTest.waitForExplicitFinish(); 1.43 + 1.44 +var testid ="html element - query syntax recursive"; 1.45 +var queryType = "rdf"; 1.46 +var isTreeBuilder = false; 1.47 +var needsOpen = false; 1.48 +var notWorkingYet = false; 1.49 +var notWorkingYetDynamic = false; 1.50 +var expectedOutput = document.getElementById("output"); 1.51 + 1.52 +var changes = [ 1.53 + // step 1 1.54 + function(targetds, root) { 1.55 + var newnode = RDF.GetResource(ZOO_NS + 'insects'); 1.56 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.57 + RDF.GetLiteral('Insects'), true); 1.58 + var container = ContainerUtils.MakeSeq(targetds, 1.59 + RDF.GetResource(ZOO_NS + 'all-animals')); 1.60 + container.InsertElementAt(newnode, '3', true); 1.61 + }, 1.62 + // step 2 1.63 + function(targetds, root) { 1.64 + var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala'); 1.65 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.66 + RDF.GetLiteral('Koala'), true); 1.67 + var container = ContainerUtils.MakeSeq(targetds, 1.68 + RDF.GetResource(ZOO_NS + 'mammals')); 1.69 + container.InsertElementAt(newnode, '4', true); 1.70 + }, 1.71 + // step 3 1.72 + function(targetds, root) { 1.73 + var container = ContainerUtils.MakeSeq(targetds, 1.74 + RDF.GetResource(ZOO_NS + 'all-animals')); 1.75 + var removednode = container.RemoveElementAt('2', true); 1.76 + targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.77 + RDF.GetLiteral('Birds'), true); 1.78 + } 1.79 +]; 1.80 +]]> 1.81 +</script> 1.82 + 1.83 +<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> 1.84 +</window>