Wed, 31 Dec 2014 06:09:35 +0100
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 | tree element - query syntax recursive multiple rules |
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 | <treecols id="treecols" orient="horizontal"> |
michael@0 | 19 | <treecol id="treecol" primary="true" label="Name" ordinal="1"/> |
michael@0 | 20 | <treecol label="Species" ordinal="3"/> |
michael@0 | 21 | </treecols> |
michael@0 | 22 | <treechildren> |
michael@0 | 23 | <treeitem id="http://www.some-fictitious-zoo.com/humans/sarah"> |
michael@0 | 24 | <treerow> |
michael@0 | 25 | <treecell label="Sarah"/> |
michael@0 | 26 | <treecell/> |
michael@0 | 27 | </treerow> |
michael@0 | 28 | </treeitem> |
michael@0 | 29 | <treeitem step="-1" id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false"> |
michael@0 | 30 | <treerow> |
michael@0 | 31 | <treecell/> |
michael@0 | 32 | <treecell label="Is this cool: Mammals?"/> |
michael@0 | 33 | </treerow> |
michael@0 | 34 | </treeitem> |
michael@0 | 35 | <treeitem step="1" id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" open="true"> |
michael@0 | 36 | <treerow> |
michael@0 | 37 | <treecell/> |
michael@0 | 38 | <treecell label="Is this cool: Mammals?"/> |
michael@0 | 39 | </treerow> |
michael@0 | 40 | <treechildren> |
michael@0 | 41 | <treeitem id="http://www.some-fictitious-zoo.com/mammals/lion"> |
michael@0 | 42 | <treerow> |
michael@0 | 43 | <treecell/> |
michael@0 | 44 | <treecell label="Is this cool: Lion?"/> |
michael@0 | 45 | </treerow> |
michael@0 | 46 | </treeitem> |
michael@0 | 47 | <treeitem id="http://www.some-fictitious-zoo.com/mammals/hippopotamus"> |
michael@0 | 48 | <treerow> |
michael@0 | 49 | <treecell label="HIPPOPOTAMUS"/> |
michael@0 | 50 | <treecell/> |
michael@0 | 51 | </treerow> |
michael@0 | 52 | </treeitem> |
michael@0 | 53 | <treeitem id="http://www.some-fictitious-zoo.com/mammals/africanelephant"> |
michael@0 | 54 | <treerow> |
michael@0 | 55 | <treecell/> |
michael@0 | 56 | <treecell label="Is this cool: African Elephant?"/> |
michael@0 | 57 | </treerow> |
michael@0 | 58 | </treeitem> |
michael@0 | 59 | <treeitem step="2" id="http://www.some-fictitious-zoo.com/mammals/koala"> |
michael@0 | 60 | <treerow> |
michael@0 | 61 | <treecell/> |
michael@0 | 62 | <treecell label="Is this cool: Koala?"/> |
michael@0 | 63 | </treerow> |
michael@0 | 64 | </treeitem> |
michael@0 | 65 | <treeitem id="http://www.some-fictitious-zoo.com/mammals/llama"> |
michael@0 | 66 | <treerow> |
michael@0 | 67 | <treecell/> |
michael@0 | 68 | <treecell label="Is this cool: LLAMA?"/> |
michael@0 | 69 | </treerow> |
michael@0 | 70 | </treeitem> |
michael@0 | 71 | <treeitem id="http://www.some-fictitious-zoo.com/mammals/polarbear"> |
michael@0 | 72 | <treerow> |
michael@0 | 73 | <treecell/> |
michael@0 | 74 | <treecell label="Is this cool: Polar Bear?"/> |
michael@0 | 75 | </treerow> |
michael@0 | 76 | </treeitem> |
michael@0 | 77 | <treeitem id="http://www.some-fictitious-zoo.com/mammals/aardvark"> |
michael@0 | 78 | <treerow> |
michael@0 | 79 | <treecell label="aardvark"/> |
michael@0 | 80 | <treecell/> |
michael@0 | 81 | </treerow> |
michael@0 | 82 | </treeitem> |
michael@0 | 83 | <treeitem id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo"> |
michael@0 | 84 | <treerow> |
michael@0 | 85 | <treecell/> |
michael@0 | 86 | <treecell label="Is this cool: Nine-banded Armadillo?"/> |
michael@0 | 87 | </treerow> |
michael@0 | 88 | </treeitem> |
michael@0 | 89 | <treeitem id="http://www.some-fictitious-zoo.com/mammals/gorilla"> |
michael@0 | 90 | <treerow> |
michael@0 | 91 | <treecell/> |
michael@0 | 92 | <treecell label="Is this cool: Gorilla?"/> |
michael@0 | 93 | </treerow> |
michael@0 | 94 | </treeitem> |
michael@0 | 95 | </treechildren> |
michael@0 | 96 | </treeitem> |
michael@0 | 97 | <treeitem step="-3" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true"> |
michael@0 | 98 | <treerow> |
michael@0 | 99 | <treecell label="Crustaceans"/> |
michael@0 | 100 | <treecell/> |
michael@0 | 101 | </treerow> |
michael@0 | 102 | </treeitem> |
michael@0 | 103 | <treeitem step="3,-4" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="false"> |
michael@0 | 104 | <treerow> |
michael@0 | 105 | <treecell label="Crustaceans"/> |
michael@0 | 106 | <treecell/> |
michael@0 | 107 | </treerow> |
michael@0 | 108 | </treeitem> |
michael@0 | 109 | <treeitem step="5" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="false" open="true"> |
michael@0 | 110 | <treerow> |
michael@0 | 111 | <treecell label="Crustaceans"/> |
michael@0 | 112 | <treecell/> |
michael@0 | 113 | </treerow> |
michael@0 | 114 | <treechildren> |
michael@0 | 115 | <treeitem id="http://www.some-fictitious-zoo.com/crustaceans/lobster"> |
michael@0 | 116 | <treerow> |
michael@0 | 117 | <treecell/> |
michael@0 | 118 | <treecell label="Is this cool: Lobster?"/> |
michael@0 | 119 | </treerow> |
michael@0 | 120 | </treeitem> |
michael@0 | 121 | <treeitem id="http://www.some-fictitious-zoo.com/crustaceans/crayfish"> |
michael@0 | 122 | <treerow> |
michael@0 | 123 | <treecell label="Crayfish"/> |
michael@0 | 124 | <treecell/> |
michael@0 | 125 | </treerow> |
michael@0 | 126 | </treeitem> |
michael@0 | 127 | </treechildren> |
michael@0 | 128 | </treeitem> |
michael@0 | 129 | <treeitem id="http://www.some-fictitious-zoo.com/birds/emu"> |
michael@0 | 130 | <treerow> |
michael@0 | 131 | <treecell label="Emu"/> |
michael@0 | 132 | <treecell/> |
michael@0 | 133 | </treerow> |
michael@0 | 134 | </treeitem> |
michael@0 | 135 | </treechildren> |
michael@0 | 136 | </data> |
michael@0 | 137 | |
michael@0 | 138 | <script src="templates_shared.js"/> |
michael@0 | 139 | |
michael@0 | 140 | <script> |
michael@0 | 141 | <![CDATA[ |
michael@0 | 142 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 143 | |
michael@0 | 144 | var testid ="tree element - query syntax recursive multiple rules"; |
michael@0 | 145 | var queryType = "rdf"; |
michael@0 | 146 | var isTreeBuilder = false; |
michael@0 | 147 | var needsOpen = false; |
michael@0 | 148 | var notWorkingYet = false; |
michael@0 | 149 | var notWorkingYetDynamic = true; |
michael@0 | 150 | var expectedOutput = document.getElementById("output"); |
michael@0 | 151 | |
michael@0 | 152 | var changes = [ |
michael@0 | 153 | // step 1 |
michael@0 | 154 | function(targetds, root) { |
michael@0 | 155 | if (root.view && 1 < root.view.rowCount && root.view.isContainer(1)) |
michael@0 | 156 | root.view.toggleOpenState(1); |
michael@0 | 157 | expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/lion', true, true, |
michael@0 | 158 | '1 matching rule 1'); |
michael@0 | 159 | expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/hippopotamus', true, true, |
michael@0 | 160 | '1 matching rule 2'); |
michael@0 | 161 | expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/africanelephant', true, true, |
michael@0 | 162 | '1 matching rule 1'); |
michael@0 | 163 | expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/llama', true, true, |
michael@0 | 164 | '1 matching rule 1'); |
michael@0 | 165 | expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/polarbear', true, true, |
michael@0 | 166 | '1 matching rule 1'); |
michael@0 | 167 | expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/aardvark', true, true, |
michael@0 | 168 | '1 matching rule 2'); |
michael@0 | 169 | expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/ninebandedarmadillo', true, true, |
michael@0 | 170 | '1 matching rule 1'); |
michael@0 | 171 | expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/gorilla', true, true, |
michael@0 | 172 | '1 matching rule 1'); |
michael@0 | 173 | }, |
michael@0 | 174 | // step 2 |
michael@0 | 175 | function(targetds, root) { |
michael@0 | 176 | var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala'); |
michael@0 | 177 | targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
michael@0 | 178 | RDF.GetLiteral('Koala'), true); |
michael@0 | 179 | var container = ContainerUtils.MakeSeq(targetds, |
michael@0 | 180 | RDF.GetResource(ZOO_NS + 'mammals')); |
michael@0 | 181 | container.InsertElementAt(newnode, '4', true); |
michael@0 | 182 | expectConsoleMessage(ZOO_NS + 'mammals', ZOO_NS + 'mammals/koala', true, true, |
michael@0 | 183 | '1 matching rule 1'); |
michael@0 | 184 | }, |
michael@0 | 185 | // step 3 |
michael@0 | 186 | function(targetds, root) { |
michael@0 | 187 | var newnode = RDF.GetResource(ZOO_NS + 'crustaceans/lobster'); |
michael@0 | 188 | targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
michael@0 | 189 | RDF.GetLiteral('Lobster'), true); |
michael@0 | 190 | var container = ContainerUtils.MakeSeq(targetds, |
michael@0 | 191 | RDF.GetResource(ZOO_NS + 'crustaceans')); |
michael@0 | 192 | container.AppendElement(newnode); |
michael@0 | 193 | }, |
michael@0 | 194 | // step 4 |
michael@0 | 195 | function(targetds, root) { |
michael@0 | 196 | var newnode = RDF.GetResource(ZOO_NS + 'crustaceans/crayfish'); |
michael@0 | 197 | targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'), |
michael@0 | 198 | RDF.GetLiteral('Crayfish'), true); |
michael@0 | 199 | var container = ContainerUtils.MakeSeq(targetds, |
michael@0 | 200 | RDF.GetResource(ZOO_NS + 'crustaceans')); |
michael@0 | 201 | container.AppendElement(newnode); |
michael@0 | 202 | }, |
michael@0 | 203 | // step 5 |
michael@0 | 204 | function(targetds, root) { |
michael@0 | 205 | if (root.view && 11 < root.view.rowCount && root.view.isContainer(11)) |
michael@0 | 206 | root.view.toggleOpenState(11); |
michael@0 | 207 | expectConsoleMessage(ZOO_NS + 'crustaceans', ZOO_NS + 'crustaceans/lobster', true, true, |
michael@0 | 208 | '1 matching rule 1'); |
michael@0 | 209 | expectConsoleMessage(ZOO_NS + 'crustaceans', ZOO_NS + 'crustaceans/crayfish', true, true, |
michael@0 | 210 | '1 matching rule 2'); |
michael@0 | 211 | }, |
michael@0 | 212 | // step 6 |
michael@0 | 213 | function(targetds, root) { |
michael@0 | 214 | if (root.view && 11 < root.view.rowCount && root.view.isContainer(11)) |
michael@0 | 215 | root.view.toggleOpenState(11); |
michael@0 | 216 | }, |
michael@0 | 217 | // step 7 |
michael@0 | 218 | function(targetds, root) { |
michael@0 | 219 | if (root.view && 1 < root.view.rowCount && root.view.isContainer(1)) |
michael@0 | 220 | root.view.toggleOpenState(1); |
michael@0 | 221 | } |
michael@0 | 222 | ]; |
michael@0 | 223 | ]]> |
michael@0 | 224 | </script> |
michael@0 | 225 | |
michael@0 | 226 | <tree xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" hidevscroll="true" hidehscroll="true" |
michael@0 | 227 | flags="logging" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/marked" id="root"> |
michael@0 | 228 | <treecols orient="horizontal" id="treecols"> |
michael@0 | 229 | <treecol id="treecol" primary="true" label="Name"/> |
michael@0 | 230 | <treecol label="Species"/> |
michael@0 | 231 | </treecols> |
michael@0 | 232 | <template id="template"> |
michael@0 | 233 | <query> |
michael@0 | 234 | <content uri="?uri"/> |
michael@0 | 235 | <member container="?uri" child="?child"/> |
michael@0 | 236 | <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/> |
michael@0 | 237 | </query> |
michael@0 | 238 | <rule> |
michael@0 | 239 | <conditions> |
michael@0 | 240 | <where subject="?name" rel="contains" value="l" ignorecase="true"/> |
michael@0 | 241 | </conditions> |
michael@0 | 242 | <action> |
michael@0 | 243 | <treechildren> |
michael@0 | 244 | <treeitem uri="?child"> |
michael@0 | 245 | <treerow> |
michael@0 | 246 | <treecell/> |
michael@0 | 247 | <treecell label="Is this cool: ?name^??"/> |
michael@0 | 248 | </treerow> |
michael@0 | 249 | </treeitem> |
michael@0 | 250 | </treechildren> |
michael@0 | 251 | </action> |
michael@0 | 252 | </rule> |
michael@0 | 253 | <rule> |
michael@0 | 254 | <action> |
michael@0 | 255 | <treechildren> |
michael@0 | 256 | <treeitem uri="?child"> |
michael@0 | 257 | <treerow> |
michael@0 | 258 | <treecell label="?name"/> |
michael@0 | 259 | <treecell/> |
michael@0 | 260 | </treerow> |
michael@0 | 261 | </treeitem> |
michael@0 | 262 | </treechildren> |
michael@0 | 263 | </action> |
michael@0 | 264 | </rule> |
michael@0 | 265 | </template> |
michael@0 | 266 | </tree> |
michael@0 | 267 | |
michael@0 | 268 | </window> |