1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/templates/tests/chrome/test_tmpl_querytwomembers.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,107 @@ 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 + query - two members 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" unordered="true"> 1.21 + <label id="http://www.some-fictitious-zoo.com/arachnids/tarantula" value="Tarantula"/> 1.22 + <label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="Wren"/> 1.23 + <label id="http://www.some-fictitious-zoo.com/birds/emu" value="Emu"/> 1.24 + <label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="Barn Owl"/> 1.25 + <label id="http://www.some-fictitious-zoo.com/birds/raven" value="Raven"/> 1.26 + <label step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx" value="Archaeopteryx"/> 1.27 + <label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="Emperor Penguin"/> 1.28 + <label id="http://www.some-fictitious-zoo.com/fish/cod" value="Cod"/> 1.29 + <label id="http://www.some-fictitious-zoo.com/fish/swordfish" value="Swordfish"/> 1.30 + <label id="http://www.some-fictitious-zoo.com/mammals/lion" value="Lion"/> 1.31 + <label id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" value="HIPPOPOTAMUS"/> 1.32 + <label id="http://www.some-fictitious-zoo.com/mammals/africanelephant" value="African Elephant"/> 1.33 + <label id="http://www.some-fictitious-zoo.com/mammals/llama" value="LLAMA"/> 1.34 + <label id="http://www.some-fictitious-zoo.com/mammals/polarbear" value="Polar Bear"/> 1.35 + <label id="http://www.some-fictitious-zoo.com/mammals/aardvark" value="aardvark"/> 1.36 + <label id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" value="Nine-banded Armadillo"/> 1.37 + <label id="http://www.some-fictitious-zoo.com/mammals/gorilla" value="Gorilla"/> 1.38 + <label id="http://www.some-fictitious-zoo.com/reptiles/anaconda" value="Anaconda"/> 1.39 + <label id="http://www.some-fictitious-zoo.com/reptiles/chameleon" value="Chameleon"/> 1.40 + </data> 1.41 + 1.42 +<script src="templates_shared.js"/> 1.43 + 1.44 +<script> 1.45 +<![CDATA[ 1.46 +SimpleTest.waitForExplicitFinish(); 1.47 + 1.48 +var testid ="query - two members"; 1.49 +var queryType = "rdf"; 1.50 +var isTreeBuilder = false; 1.51 +var needsOpen = false; 1.52 +var notWorkingYet = false; 1.53 +var notWorkingYetDynamic = false; 1.54 +var expectedOutput = document.getElementById("output"); 1.55 + 1.56 +var changes = [ 1.57 + // step 1 1.58 + function(targetds, root) { 1.59 + var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin'); 1.60 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.61 + RDF.GetLiteral('Emperor Penguin'), true); 1.62 + var container = ContainerUtils.MakeSeq(targetds, 1.63 + RDF.GetResource(ZOO_NS + 'birds')); 1.64 + container.AppendElement(newnode); 1.65 + }, 1.66 + // step 2 1.67 + function(targetds, root) { 1.68 + var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx'); 1.69 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.70 + RDF.GetLiteral('Archaeopteryx'), true); 1.71 + var container = ContainerUtils.MakeSeq(targetds, 1.72 + RDF.GetResource(ZOO_NS + 'birds')); 1.73 + container.InsertElementAt(newnode, '4', true); 1.74 + }, 1.75 + // step 3 1.76 + function(targetds, root) { 1.77 + var newnode = RDF.GetResource(ZOO_NS + 'birds/wren'); 1.78 + targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.79 + RDF.GetLiteral('Wren'), true); 1.80 + var container = ContainerUtils.MakeSeq(targetds, 1.81 + RDF.GetResource(ZOO_NS + 'birds')); 1.82 + container.InsertElementAt(newnode, '1', true); 1.83 + }, 1.84 + // step 4 1.85 + function(targetds, root) { 1.86 + var container = ContainerUtils.MakeSeq(targetds, 1.87 + RDF.GetResource(ZOO_NS + 'birds')); 1.88 + var removednode = container.RemoveElementAt('3', true); 1.89 + targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'), 1.90 + RDF.GetLiteral('Barn Owl'), true); 1.91 + } 1.92 +]; 1.93 +]]> 1.94 +</script> 1.95 + 1.96 +<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/all-animals"> 1.97 +<template id="template"> 1.98 +<query id="query"> 1.99 +<content uri="?uri"/> 1.100 +<member container="?uri" child="?childone"/> 1.101 +<member container="?childone" child="?child"/> 1.102 +<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/> 1.103 +</query> 1.104 +,<action> 1.105 +<label uri="?child" value="?name"/> 1.106 +</action> 1.107 +</template> 1.108 +</vbox> 1.109 + 1.110 +</window>