content/xul/templates/tests/chrome/test_tmpl_treeelementquerysyntaxnotrecursivetreebuilder.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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 not recursive tree builder
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="true">
michael@0 30 <treerow>
michael@0 31 <treecell label="Mammals"/>
michael@0 32 <treecell/>
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="true" open="">
michael@0 36 <treerow>
michael@0 37 <treecell label="Mammals"/>
michael@0 38 <treecell/>
michael@0 39 </treerow>
michael@0 40 </treeitem>
michael@0 41 <treeitem step="-4" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true">
michael@0 42 <treerow>
michael@0 43 <treecell label="Crustaceans"/>
michael@0 44 <treecell/>
michael@0 45 </treerow>
michael@0 46 </treeitem>
michael@0 47 <treeitem step="4" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true">
michael@0 48 <treerow>
michael@0 49 <treecell label="Crustaceans"/>
michael@0 50 <treecell/>
michael@0 51 </treerow>
michael@0 52 </treeitem>
michael@0 53 <treeitem id="http://www.some-fictitious-zoo.com/birds/emu">
michael@0 54 <treerow>
michael@0 55 <treecell label="Emu"/>
michael@0 56 <treecell/>
michael@0 57 </treerow>
michael@0 58 </treeitem>
michael@0 59 </treechildren>
michael@0 60 </data>
michael@0 61
michael@0 62 <script src="templates_shared.js"/>
michael@0 63
michael@0 64 <script>
michael@0 65 <![CDATA[
michael@0 66 SimpleTest.waitForExplicitFinish();
michael@0 67
michael@0 68 var testid ="tree element - query syntax not recursive tree builder";
michael@0 69 var queryType = "rdf";
michael@0 70 var isTreeBuilder = true;
michael@0 71 var needsOpen = false;
michael@0 72 var notWorkingYet = false;
michael@0 73 var notWorkingYetDynamic = false;
michael@0 74 var expectedOutput = document.getElementById("output");
michael@0 75
michael@0 76 var changes = [
michael@0 77 // step 1
michael@0 78 function(targetds, root) {
michael@0 79 if (root.view && 1 < root.view.rowCount && root.view.isContainer(1))
michael@0 80 root.view.toggleOpenState(1);
michael@0 81 },
michael@0 82 // step 2
michael@0 83 function(targetds, root) {
michael@0 84 var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
michael@0 85 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 86 RDF.GetLiteral('Koala'), true);
michael@0 87 var container = ContainerUtils.MakeSeq(targetds,
michael@0 88 RDF.GetResource(ZOO_NS + 'mammals'));
michael@0 89 container.InsertElementAt(newnode, '4', true);
michael@0 90 },
michael@0 91 // step 3
michael@0 92 function(targetds, root) {
michael@0 93 var newnode = RDF.GetResource(ZOO_NS + 'crustaceans/lobster');
michael@0 94 targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
michael@0 95 RDF.GetLiteral('Lobster'), true);
michael@0 96 var container = ContainerUtils.MakeSeq(targetds,
michael@0 97 RDF.GetResource(ZOO_NS + 'crustaceans'));
michael@0 98 container.AppendElement(newnode);
michael@0 99 },
michael@0 100 // step 4
michael@0 101 function(targetds, root) {
michael@0 102 if (root.view && 11 < root.view.rowCount && root.view.isContainer(11))
michael@0 103 root.view.toggleOpenState(11);
michael@0 104 },
michael@0 105 // step 5
michael@0 106 function(targetds, root) {
michael@0 107 if (root.view && 11 < root.view.rowCount && root.view.isContainer(11))
michael@0 108 root.view.toggleOpenState(11);
michael@0 109 },
michael@0 110 // step 6
michael@0 111 function(targetds, root) {
michael@0 112 if (root.view && 1 < root.view.rowCount && root.view.isContainer(1))
michael@0 113 root.view.toggleOpenState(1);
michael@0 114 }
michael@0 115 ];
michael@0 116 ]]>
michael@0 117 </script>
michael@0 118
michael@0 119 <tree xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" hidevscroll="true" hidehscroll="true" datasources="rdf:null" ref="http://www.some-fictitious-zoo.com/marked" flags="dont-recurse dont-build-content" id="root">
michael@0 120 <treecols orient="horizontal" id="treecols">
michael@0 121 <treecol id="treecol" primary="true" label="Name"/>
michael@0 122 <treecol label="Species"/>
michael@0 123 </treecols>
michael@0 124 <template id="template">
michael@0 125 <query>
michael@0 126 <content uri="?uri"/>
michael@0 127 <member container="?uri" child="?child"/>
michael@0 128 <triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
michael@0 129 </query>
michael@0 130 <rule>
michael@0 131 <action>
michael@0 132 <treechildren>
michael@0 133 <treeitem uri="?child">
michael@0 134 <treerow>
michael@0 135 <treecell label="?name"/>
michael@0 136 <treecell/>
michael@0 137 </treerow>
michael@0 138 </treeitem>
michael@0 139 </treechildren>
michael@0 140 </action>
michael@0 141 </rule>
michael@0 142 </template>
michael@0 143 </tree>
michael@0 144
michael@0 145 </window>

mercurial