content/xul/templates/tests/chrome/test_tmpl_parentsimplesyntax.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.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     5 <!--
     6   parent - simple syntax
     7 -->
     9 <window title="XUL Template Tests" width="500" height="600"
    10         onload="test_template();"
    11         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    12   <script type="application/javascript"
    13           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    15   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    17   <data id="output">
    18     <hbox step="-3" id="http://www.some-fictitious-zoo.com/birds" container="true" empty="false">
    19       <label value="Birds"/>
    20       <button id="http://www.some-fictitious-zoo.com/birds/emu" label="Emu"/>
    21       <button id="http://www.some-fictitious-zoo.com/birds/barnowl" label="Barn Owl"/>
    22       <button id="http://www.some-fictitious-zoo.com/birds/raven" label="Raven"/>
    23     </hbox>
    24     <hbox step="1" id="http://www.some-fictitious-zoo.com/insects">
    25       <label value="Insects"/>
    26     </hbox>
    27     <hbox id="http://www.some-fictitious-zoo.com/crustaceans" container="true" empty="true">
    28       <label value="Crustaceans"/>
    29     </hbox>
    30     <hbox id="http://www.some-fictitious-zoo.com/mammals" container="true" empty="false">
    31       <label value="Mammals"/>
    32       <button id="http://www.some-fictitious-zoo.com/mammals/lion" label="Lion"/>
    33       <button id="http://www.some-fictitious-zoo.com/mammals/hippopotamus" label="HIPPOPOTAMUS"/>
    34       <button id="http://www.some-fictitious-zoo.com/mammals/africanelephant" label="African Elephant"/>
    35       <button step="2" id="http://www.some-fictitious-zoo.com/mammals/koala" label="Koala"/>
    36       <button id="http://www.some-fictitious-zoo.com/mammals/llama" label="LLAMA"/>
    37       <button id="http://www.some-fictitious-zoo.com/mammals/polarbear" label="Polar Bear"/>
    38       <button id="http://www.some-fictitious-zoo.com/mammals/aardvark" label="aardvark"/>
    39       <button id="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" label="Nine-banded Armadillo"/>
    40       <button id="http://www.some-fictitious-zoo.com/mammals/gorilla" label="Gorilla"/>
    41     </hbox>
    42   </data>
    44 <script src="templates_shared.js"/>
    46 <script>
    47 <![CDATA[
    48 SimpleTest.waitForExplicitFinish();
    50 var testid ="parent - simple syntax";
    51 var queryType = "rdf";
    52 var isTreeBuilder = false;
    53 var needsOpen = false;
    54 var notWorkingYet = false;
    55 var notWorkingYetDynamic = false;
    56 var expectedOutput = document.getElementById("output");
    58 var changes = [
    59   // step 1
    60   function(targetds, root) {
    61     var newnode = RDF.GetResource(ZOO_NS + 'insects');
    62     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    63                     RDF.GetLiteral('Insects'), true);
    64     var container = ContainerUtils.MakeSeq(targetds,
    65                       RDF.GetResource(ZOO_NS + 'all-animals'));
    66     container.InsertElementAt(newnode, '3', true);
    67   },
    68   // step 2
    69   function(targetds, root) {
    70     var newnode = RDF.GetResource(ZOO_NS + 'mammals/koala');
    71     targetds.Assert(newnode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    72                     RDF.GetLiteral('Koala'), true);
    73     var container = ContainerUtils.MakeSeq(targetds,
    74                       RDF.GetResource(ZOO_NS + 'mammals'));
    75     container.InsertElementAt(newnode, '4', true);
    76   },
    77   // step 3
    78   function(targetds, root) {
    79     var container = ContainerUtils.MakeSeq(targetds,
    80                       RDF.GetResource(ZOO_NS + 'all-animals'));
    81     var removednode = container.RemoveElementAt('2', true);
    82     targetds.Unassert(removednode, RDF.GetResource(ZOO_NS + 'rdf#name'),
    83                       RDF.GetLiteral('Birds'), true);
    84   }
    85 ];
    86 ]]>
    87 </script>
    89 <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">
    90 <template member="?parent">
    91 <rule parent="hbox">
    92 <button uri="?parent" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
    93 </rule>
    94 <rule>
    95 <conditions>
    96 <content uri="?uri"/>
    97 <member container="?uri" child="?parent"/>
    98 <triple subject="?parent" predicate="http://www.some-fictitious-zoo.com/rdf#name" object="?name"/>
    99 <where subject="?name" rel="equals" multiple="true" value="Mammals,Crustaceans,Birds,Insects"/>
   100 </conditions>
   101 <action>
   102 <hbox uri="?parent">
   103 <label value="?name"/>
   104 </hbox>
   105 </action>
   106 </rule>
   107 </template>
   108 </vbox>
   110 </window>

mercurial