content/xul/templates/tests/chrome/test_tmpl_gridelement.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
michael@0 4
michael@0 5 <!--
michael@0 6 grid element
michael@0 7 -->
michael@0 8
michael@0 9 <window title="XUL Template Tests" width="500" height="600"
michael@0 10 onload="test_template();"
michael@0 11 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 12 <script type="application/javascript"
michael@0 13 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 14
michael@0 15 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
michael@0 16
michael@0 17 <data id="output">
michael@0 18 <columns>
michael@0 19 <column/>
michael@0 20 <column/>
michael@0 21 </columns>
michael@0 22 <rows>
michael@0 23 <label step="3" id="http://www.some-fictitious-zoo.com/birds/wren" value="The coolest animal is: Wren"/>
michael@0 24 <row id="http://www.some-fictitious-zoo.com/birds/emu">
michael@0 25 <label value="Emu"/>
michael@0 26 <label value="Birds"/>
michael@0 27 </row>
michael@0 28 <label step="-4" id="http://www.some-fictitious-zoo.com/birds/barnowl" value="The coolest animal is: Barn Owl"/>
michael@0 29 <row id="http://www.some-fictitious-zoo.com/birds/raven">
michael@0 30 <label value="Raven"/>
michael@0 31 <label value="Birds"/>
michael@0 32 </row>
michael@0 33 <row step="2" id="http://www.some-fictitious-zoo.com/birds/archaeopteryx">
michael@0 34 <label value="Archaeopteryx"/>
michael@0 35 <label value="Birds"/>
michael@0 36 </row>
michael@0 37 <label step="1" id="http://www.some-fictitious-zoo.com/birds/emperorpenguin" value="The coolest animal is: Emperor Penguin"/>
michael@0 38 </rows>
michael@0 39 </data>
michael@0 40
michael@0 41 <script src="templates_shared.js"/>
michael@0 42
michael@0 43 <script>
michael@0 44 <![CDATA[
michael@0 45 SimpleTest.waitForExplicitFinish();
michael@0 46
michael@0 47 var testid ="grid element";
michael@0 48 var queryType = "rdf";
michael@0 49 var isTreeBuilder = false;
michael@0 50 var needsOpen = false;
michael@0 51 var notWorkingYet = false;
michael@0 52 var notWorkingYetDynamic = false;
michael@0 53 var expectedOutput = document.getElementById("output");
michael@0 54
michael@0 55 var changes = [
michael@0 56 // step 1
michael@0 57 function(targetds, root) {
michael@0 58 var newnode = RDF.GetResource(ZOO_NS + 'birds/emperorpenguin');
michael@0 59 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 60 RDF.GetLiteral('Emperor Penguin'), true);
michael@0 61 var container = ContainerUtils.MakeSeq(targetds,
michael@0 62 RDF.GetResource(ZOO_NS + 'birds'));
michael@0 63 container.AppendElement(newnode);
michael@0 64 },
michael@0 65 // step 2
michael@0 66 function(targetds, root) {
michael@0 67 var newnode = RDF.GetResource(ZOO_NS + 'birds/archaeopteryx');
michael@0 68 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 69 RDF.GetLiteral('Archaeopteryx'), true);
michael@0 70 var container = ContainerUtils.MakeSeq(targetds,
michael@0 71 RDF.GetResource(ZOO_NS + 'birds'));
michael@0 72 container.InsertElementAt(newnode, '4', true);
michael@0 73 },
michael@0 74 // step 3
michael@0 75 function(targetds, root) {
michael@0 76 var newnode = RDF.GetResource(ZOO_NS + 'birds/wren');
michael@0 77 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 78 RDF.GetLiteral('Wren'), true);
michael@0 79 var container = ContainerUtils.MakeSeq(targetds,
michael@0 80 RDF.GetResource(ZOO_NS + 'birds'));
michael@0 81 container.InsertElementAt(newnode, '1', true);
michael@0 82 },
michael@0 83 // step 4
michael@0 84 function(targetds, root) {
michael@0 85 var container = ContainerUtils.MakeSeq(targetds,
michael@0 86 RDF.GetResource(ZOO_NS + 'birds'));
michael@0 87 var removednode = container.RemoveElementAt('3', true);
michael@0 88 targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 89 RDF.GetLiteral('Barn Owl'), true);
michael@0 90 }
michael@0 91 ];
michael@0 92 ]]>
michael@0 93 </script>
michael@0 94
michael@0 95 <grid xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="root" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/birds">
michael@0 96 <columns>
michael@0 97 <column/>
michael@0 98 <column/>
michael@0 99 </columns>
michael@0 100 <template>
michael@0 101 <query>
michael@0 102 <content uri="?uri"/>
michael@0 103 <member container="?uri" child="?child"/>
michael@0 104 <triple subject="?uri" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?classname"/>
michael@0 105 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
michael@0 106 </query>
michael@0 107 <rule>
michael@0 108 <conditions>
michael@0 109 <where subject="?name" rel="equals" value="Raven" negate="true"/>
michael@0 110 <where subject="?name" rel="contains" value="n"/>
michael@0 111 </conditions>
michael@0 112 <action>
michael@0 113 <rows>
michael@0 114 <label uri="?child" value="The coolest animal is: ?name"/>
michael@0 115 </rows>
michael@0 116 </action>
michael@0 117 </rule>
michael@0 118 <rule>
michael@0 119 <action>
michael@0 120 <rows>
michael@0 121 <row uri="?child">
michael@0 122 <label value="?name"/>
michael@0 123 <label value="?classname"/>
michael@0 124 </row>
michael@0 125 </rows>
michael@0 126 </action>
michael@0 127 </rule>
michael@0 128 </template>
michael@0 129 </grid>
michael@0 130
michael@0 131 </window>

mercurial