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.
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 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
7 <vbox id="box"/>
9 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
11 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
13 <script type="application/x-javascript">
14 <![CDATA[
16 var tests = [
17 [["One", "Two", "Three", "Four"], "", ["Four One Three Two"]],
18 [["One", "Two", "Three", "Four"], "integer", ["Four One Three Two"]],
19 [["One", "Two", "Three", "Four"], "descending", ["Two Three One Four"]],
20 [["One", "Two", "Three", "Four"], "descending integer", ["Two Three One Four"]],
21 [["One", "Two", "Three", "Four"], "integer cat descending", ["Two Three One Four"]],
22 [["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "", ["1 12 13 170 2 2 222 240 7 98"]],
23 [["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "integer", ["1 2 2 7 12 13 98 170 222 240"]],
24 [["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "ascending integer", ["1 2 2 7 12 13 98 170 222 240"]],
25 [["1", "13", "2", "7", "12", "240", "2", "170", "222", "98"], "integer descending", ["240 222 170 98 13 12 7 2 2 1"]],
26 [["Cat", "cat", "Candy", "candy"], "comparecase", ["Candy Cat candy cat"]],
27 [["1", "102", "22", "One", "40", "Two"], "integer", ["1 22 40 102 One Two"]],
28 ];
30 SimpleTest.waitForExplicitFinish();
32 function doTests()
33 {
34 var box = document.getElementById("box");
36 const sortService = Components.classes["@mozilla.org/xul/xul-sort-service;1"].
37 getService(Components.interfaces.nsIXULSortService);
39 for (let t = 0; t < tests.length; t++) {
40 var test = tests[t];
42 for (let e = 0; e < test[0].length; e++) {
43 var label = document.createElement("label");
44 label.setAttribute("value", test[0][e]);
45 box.appendChild(label);
46 }
48 sortService.sort(box, "value", test[1]);
50 var actual = "";
51 for (let e = 0; e < box.childNodes.length; e++) {
52 if (actual)
53 actual += " ";
54 actual += box.childNodes[e].getAttribute("value");
55 }
56 is(actual, test[2], "sorted step " + (t + 1));
58 while(box.hasChildNodes())
59 box.removeChild(box.firstChild);
60 box.removeAttribute("sortDirection");
61 }
63 SimpleTest.finish();
64 }
66 window.addEventListener("load", doTests, false);
68 ]]>
69 </script>
70 </window>