1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/templates/tests/chrome/test_tmpl_simplesyntaxusingrecursivegeneration.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,109 @@ 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 + simple syntax using recursive generation 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"> 1.21 + <hbox id="http://www.some-fictitious-zoo.com/arachnids" container="true" empty="false"> 1.22 + <label value="Arachnids"/> 1.23 + <hbox id="http://www.some-fictitious-zoo.com/arachnids/tarantula"> 1.24 + <label value="Tarantula"/> 1.25 + </hbox> 1.26 + </hbox> 1.27 + <hbox id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false"> 1.28 + <label value="Birds"/> 1.29 + <hbox step="3" id="http://www.some-fictitious-zoo.com/birds/wren"> 1.30 + <label value="Wren"/> 1.31 + </hbox> 1.32 + <hbox id="http://www.some-fictitious-zoo.com/birds/emu"> 1.33 + <label value="Emu"/> 1.34 + </hbox> 1.35 + <hbox step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl"> 1.36 + <label value="Barn Owl"/> 1.37 + </hbox> 1.38 + <hbox id="http://www.some-fictitious-zoo.com/birds/raven"> 1.39 + <label value="Raven"/> 1.40 + </hbox> 1.41 + <hbox step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx"> 1.42 + <label value="Archaeopteryx"/> 1.43 + </hbox> 1.44 + <hbox step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin"> 1.45 + <label value="Emperor Penguin"/> 1.46 + </hbox> 1.47 + </hbox> 1.48 + </data> 1.49 + 1.50 +<script src="templates_shared.js"/> 1.51 + 1.52 +<script> 1.53 +<![CDATA[ 1.54 +SimpleTest.waitForExplicitFinish(); 1.55 + 1.56 +var testid ="simple syntax using recursive generation"; 1.57 +var queryType = "rdf"; 1.58 +var isTreeBuilder = false; 1.59 +var needsOpen = false; 1.60 +var notWorkingYet = false; 1.61 +var notWorkingYetDynamic = false; 1.62 +var expectedOutput = document.getElementById("output"); 1.63 + 1.64 +var changes = [ 1.65 + // step 1 1.66 + function(targetds, root) { 1.67 + var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin'); 1.68 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.69 + RDF.GetLiteral('Emperor Penguin'), true); 1.70 + var container = ContainerUtils.MakeSeq(targetds, 1.71 + RDF.GetResource(ZOO_NS + 'birds')); 1.72 + container.AppendElement(newnode); 1.73 + }, 1.74 + // step 2 1.75 + function(targetds, root) { 1.76 + var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx'); 1.77 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.78 + RDF.GetLiteral('Archaeopteryx'), true); 1.79 + var container = ContainerUtils.MakeSeq(targetds, 1.80 + RDF.GetResource(ZOO_NS + 'birds')); 1.81 + container.InsertElementAt(newnode, '4', true); 1.82 + }, 1.83 + // step 3 1.84 + function(targetds, root) { 1.85 + var newnode = RDF.GetResource(ZOO_NS + 'birds/wren'); 1.86 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.87 + RDF.GetLiteral('Wren'), true); 1.88 + var container = ContainerUtils.MakeSeq(targetds, 1.89 + RDF.GetResource(ZOO_NS + 'birds')); 1.90 + container.InsertElementAt(newnode, '1', true); 1.91 + }, 1.92 + // step 4 1.93 + function(targetds, root) { 1.94 + var container = ContainerUtils.MakeSeq(targetds, 1.95 + RDF.GetResource(ZOO_NS + 'birds')); 1.96 + var removednode = container.RemoveElementAt('3', true); 1.97 + targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.98 + RDF.GetLiteral('Barn Owl'), true); 1.99 + } 1.100 +]; 1.101 +]]> 1.102 +</script> 1.103 + 1.104 +<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/some-animals"> 1.105 +<template id="template"> 1.106 +<hbox uri="rdf:*"> 1.107 +<label value="rdf:http://www.some-fictitious-zoo.com/rdf#name"/> 1.108 +</hbox> 1.109 +</template> 1.110 +</vbox> 1.111 + 1.112 +</window>