content/xul/templates/tests/chrome/test_tmpl_treeelementquerysyntaxnotrecursive.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/xul/templates/tests/chrome/test_tmpl_treeelementquerysyntaxnotrecursive.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,145 @@
     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 +  tree element - query syntax not recursive
    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 +    <treecols id="treecols" orient="horizontal">
    1.22 +      <treecol id="treecol" primary="true" label="Name" ordinal="1"/>
    1.23 +      <treecol label="Species" ordinal="3"/>
    1.24 +    </treecols>
    1.25 +    <treechildren>
    1.26 +      <treeitem id="http://www.some-fictitious-zoo.com/humans/sarah">
    1.27 +        <treerow>
    1.28 +          <treecell label="Sarah"/>
    1.29 +          <treecell/>
    1.30 +        </treerow>
    1.31 +      </treeitem>
    1.32 +      <treeitem step="-1" id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false">
    1.33 +        <treerow>
    1.34 +          <treecell label="Mammals"/>
    1.35 +          <treecell/>
    1.36 +        </treerow>
    1.37 +      </treeitem>
    1.38 +      <treeitem step="1" id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false" open="true">
    1.39 +        <treerow>
    1.40 +          <treecell label="Mammals"/>
    1.41 +          <treecell/>
    1.42 +        </treerow>
    1.43 +      </treeitem>
    1.44 +      <treeitem step="-4" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true">
    1.45 +        <treerow>
    1.46 +          <treecell label="Crustaceans"/>
    1.47 +          <treecell/>
    1.48 +        </treerow>
    1.49 +      </treeitem>
    1.50 +      <treeitem step="4" id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true">
    1.51 +        <treerow>
    1.52 +          <treecell label="Crustaceans"/>
    1.53 +          <treecell/>
    1.54 +        </treerow>
    1.55 +      </treeitem>
    1.56 +      <treeitem id="http://www.some-fictitious-zoo.com/birds/emu">
    1.57 +        <treerow>
    1.58 +          <treecell label="Emu"/>
    1.59 +          <treecell/>
    1.60 +        </treerow>
    1.61 +      </treeitem>
    1.62 +    </treechildren>
    1.63 +  </data>
    1.64 +
    1.65 +<script src="templates_shared.js"/>
    1.66 +
    1.67 +<script>
    1.68 +<![CDATA[
    1.69 +SimpleTest.waitForExplicitFinish();
    1.70 +
    1.71 +var testid ="tree element - query syntax not recursive";
    1.72 +var queryType = "rdf";
    1.73 +var isTreeBuilder = false;
    1.74 +var needsOpen = false;
    1.75 +var notWorkingYet = false;
    1.76 +var notWorkingYetDynamic = true;
    1.77 +var expectedOutput = document.getElementById("output");
    1.78 +
    1.79 +var changes = [
    1.80 +  // step 1
    1.81 +  function(targetds, root) {
    1.82 +    if (root.view && 1 < root.view.rowCount  && root.view.isContainer(1))
    1.83 +    root.view.toggleOpenState(1);
    1.84 +  },
    1.85 +  // step 2
    1.86 +  function(targetds, root) {
    1.87 +    var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
    1.88 +    targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    1.89 +                    RDF.GetLiteral('Koala'), true);
    1.90 +    var container = ContainerUtils.MakeSeq(targetds,
    1.91 +                      RDF.GetResource(ZOO_NS + 'mammals'));
    1.92 +    container.InsertElementAt(newnode, '4', true);
    1.93 +  },
    1.94 +  // step 3
    1.95 +  function(targetds, root) {
    1.96 +    var newnode = RDF.GetResource(ZOO_NS + 'crustaceans/lobster');
    1.97 +    targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    1.98 +                    RDF.GetLiteral('Lobster'), true);
    1.99 +    var container = ContainerUtils.MakeSeq(targetds,
   1.100 +                      RDF.GetResource(ZOO_NS + 'crustaceans'));
   1.101 +    container.AppendElement(newnode);
   1.102 +  },
   1.103 +  // step 4
   1.104 +  function(targetds, root) {
   1.105 +    if (root.view && 11 < root.view.rowCount  && root.view.isContainer(11))
   1.106 +    root.view.toggleOpenState(11);
   1.107 +  },
   1.108 +  // step 5
   1.109 +  function(targetds, root) {
   1.110 +    if (root.view && 11 < root.view.rowCount  && root.view.isContainer(11))
   1.111 +    root.view.toggleOpenState(11);
   1.112 +  },
   1.113 +  // step 6
   1.114 +  function(targetds, root) {
   1.115 +    if (root.view && 1 < root.view.rowCount  && root.view.isContainer(1))
   1.116 +    root.view.toggleOpenState(1);
   1.117 +  }
   1.118 +];
   1.119 +]]>
   1.120 +</script>
   1.121 +
   1.122 +<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" id="root">
   1.123 +<treecols orient="horizontal" id="treecols">
   1.124 +<treecol id="treecol" primary="true" label="Name"/>
   1.125 +<treecol label="Species"/>
   1.126 +</treecols>
   1.127 +<template id="template">
   1.128 +<query>
   1.129 +<content uri="?uri"/>
   1.130 +<member container="?uri" child="?child"/>
   1.131 +<triple subject="?child" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
   1.132 +</query>
   1.133 +<rule>
   1.134 +<action>
   1.135 +<treechildren>
   1.136 +<treeitem uri="?child">
   1.137 +<treerow>
   1.138 +<treecell label="?name"/>
   1.139 +<treecell/>
   1.140 +</treerow>
   1.141 +</treeitem>
   1.142 +</treechildren>
   1.143 +</action>
   1.144 +</rule>
   1.145 +</template>
   1.146 +</tree>
   1.147 +
   1.148 +</window>

mercurial