]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/mozilla/menuhead.html
JavaScriptCore-461.tar.gz
[apple/javascriptcore.git] / tests / mozilla / menuhead.html
CommitLineData
b37bf2e1
A
1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3 <head>
4 <title>Core JavaScript Tests</title>
5
6 <script language="JavaScript">
7 function selectAll (suite, testDir)
8 {
9 if (typeof suite == "undefined")
10 for (var suite in suites)
11 setAllDirs (suite, true);
12 else if (typeof testDir == "undefined")
13 setAllDirs (suite, true);
14 else
15 setAllTests (suite, testDir, true);
16 updateTotals();
17 }
18
19 function selectNone (suite, testDir)
20 {
21
22 if (typeof suite == "undefined")
23 for (var suite in suites)
24 setAllDirs (suite, false);
25 else if (typeof testDir == "undefined")
26 setAllDirs (suite, false);
27 else
28 setAllTests (suite, testDir, false);
29 updateTotals();
30 }
31
32 function setAllDirs (suite, value)
33 {
34 var dir;
35 for (dir in suites[suite].testDirs)
36 setAllTests (suite, dir, value);
37
38 }
39
40 function setAllTests (suite, testDir, value)
41 {
42 var test, radioName;
43
44 for (test in suites[suite].testDirs[testDir].tests)
45 {
46 radioName = suites[suite].testDirs[testDir].tests[test];
47 document.forms["testCases"].elements[radioName].checked = value;
48 }
49
50 }
51
52 function createList ()
53 {
54 var suite, testDir, test, radioName;
55 var elements = document.forms["testCases"].elements;
56
57 var win = window.open ("about:blank", "other_window");
58 win.document.open();
59 win.document.write ("<pre>\n");
60
61 win.document.write ("# Created " + new Date() + "\n");
62
63 for (suite in suites)
64 win.document.write ("# " + suite + ": " +
65 elements["SUMMARY_" + suite].value + "\n");
66 win.document.write ("# TOTAL: " + elements["TOTAL"].value + "\n");
67
68 for (suite in suites)
69 for (testDir in suites[suite].testDirs)
70 for (test in suites[suite].testDirs[testDir].tests)
71 {
72 radioName = suites[suite].testDirs[testDir].tests[test];
73 if (elements[radioName].checked)
74 win.document.write (suite + "/" + testDir + "/" +
75 elements[radioName].value + "\n");
76 }
77
78 win.document.close();
79
80 }
81
82 function onRadioClick (name)
83 {
84 var radio = document.forms["testCases"].elements[name];
85 radio.checked = !radio.checked;
86 setTimeout ("updateTotals();", 100);
87 return false;
88 }
89
90 function updateTotals()
91 {
92 var suite, testDir, test, radioName, selected, available, pct;
93 var totalAvailable = 0, totalSelected = 0;
94
95 var elements = document.forms["testCases"].elements;
96
97 for (suite in suites)
98 {
99 selected = available = 0;
100 for (testDir in suites[suite].testDirs)
101 for (test in suites[suite].testDirs[testDir].tests)
102 {
103 available++
104 radioName = suites[suite].testDirs[testDir].tests[test];
105 if (elements[radioName].checked)
106 selected++;
107 }
108 totalSelected += selected;
109 totalAvailable += available;
110 pct = parseInt((selected / available) * 100);
111 if (isNaN(pct))
112 pct = 0;
113
114 elements["SUMMARY_" + suite].value = selected + "/" + available +
115 " (" + pct + "%) selected";
116 }
117
118 pct = parseInt((totalSelected / totalAvailable) * 100);
119 if (isNaN(pct))
120 pct = 0;
121
122 elements["TOTAL"].value = totalSelected + "/" + totalAvailable + " (" +
123 pct + "%) selected";
124
125 }
126
127 </script>
128
129 </head>
130
131 <body bgcolor="white" onLoad="updateTotals()">
132 <a name='top_of_page'></a>
133 <h1>Core JavaScript Tests</h1>
134
135 <form name="testCases">
136 <input type='button' value='Export Test List' onClick='createList();'>
137 <input type='button' value='Import Test List'
138 onClick='window.open("importList.html", "other_window");'>