toolkit/content/tests/chrome/test_sorttemplate.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"?>
     4 <?xml-stylesheet href="data:text/css,window > |people { display: none }" type="text/css"?>
     5 <!--
     6   XUL Widget Test for tabindex
     7   -->
     8 <window title="tabindex" width="500" height="600"
     9         onfocus="runTest()"
    10         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    11   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>  
    12   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>  
    14 <people id="famouspeople" xmlns="">
    15     <person name="Napoleon Bonaparte" gender="male"/>
    16     <person name="Cleopatra" gender="female"/>
    17     <person name="Julius Caesar" gender="male"/>
    18     <person name="Ferdinand Magellan" gender="male"/>
    19     <person name="Laura Secord" gender="female"/>
    20 </people>
    22 <tree id="tree" datasources="#famouspeople" ref="*" querytype="xml" flex="1">
    23   <treecols>
    24     <treecol label="Name" flex="1" sort="?name"/>
    25     <treecol label="Gender" flex="1" sort="?gender"/>
    26   </treecols>
    27   <template>
    28     <query/>
    29     <rule>
    30       <action>
    31         <treechildren id="treechildren-strings">
    32           <treeitem uri="?">
    33             <treerow>
    34               <treecell label="?name"/>
    35               <treecell label="?gender"/>
    36             </treerow>
    37           </treeitem>
    38         </treechildren>
    39       </action>
    40     </rule>
    41   </template>
    42 </tree>
    44 <body xmlns="http://www.w3.org/1999/xhtml">
    45 <p id="display"></p>
    46 <div id="content" style="display: none">
    47 </div>
    48 <pre id="test">
    49 </pre>
    50 </body>
    52 <script>
    53 <![CDATA[
    55 SimpleTest.waitForExplicitFinish();
    57 function runTest()
    58 {
    59   var tree = $("tree");
    60   var col = tree.columns[0].element;
    61   synthesizeMouse(col, 12, 2, { });
    62   checkRowOrder(tree, ["Cleopatra", "Ferdinand Magellan", "Julius Caesar", "Laura Secord", "Napoleon Bonaparte"], "acsending");
    64   synthesizeMouse(col, 12, 2, { });
    65   checkRowOrder(tree, ["Napoleon Bonaparte", "Laura Secord", "Julius Caesar", "Ferdinand Magellan", "Cleopatra"], "descending");
    67   synthesizeMouse(col, 12, 2, { });
    68   checkRowOrder(tree, ["Napoleon Bonaparte", "Laura Secord", "Julius Caesar", "Ferdinand Magellan", "Cleopatra"], "natural");
    70   SimpleTest.finish();
    71 }
    73 function checkRowOrder(tree, expected, testid)
    74 {
    75   var index = 0;
    76   var item = tree.firstChild.nextSibling.nextSibling.firstChild;
    77   while (item && index < expected.length) {
    78     if (item.firstChild.firstChild.getAttribute("label") != expected[index++])
    79       break;
    80     item = item.nextSibling;
    81   }
    82   ok(index == expected.length && !item, testid + " row order");
    83 }
    85 ]]>
    87 </script>
    89 </window>

mercurial