/[suikacvs]/www/test/html/progress/reqs/tests.html
Suika

Contents of /www/test/html/progress/reqs/tests.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download) (as text)
Sun Oct 18 08:12:05 2009 UTC (15 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.1: +1 -1 lines
File MIME type: text/html
oops, s/progress/meter/

1 wakaba 1.1 <!DOCTYPE HTML>
2 wakaba 1.2 <title>&lt;meter> processing and authoring requirements</title>
3 wakaba 1.1 <style>
4     .disagree {
5     background-color: red;
6     }
7     </style>
8    
9     <pre id=inputs style="display: none">
10    
11    
12     0
13     0.
14     10
15     100.
16     100.2
17     .23
18     10 10
19     10 20 30
20     5%
21     5.%
22     5.00%
23     100 %
24     200,%
25     100% 200%
26     100% 20,%
27     .5%
28     .2% .5%
29     %100%
30     50..
31     .
32     ..
33     .. 10
34     .. 10 20
35     1 . 2
36     10 .. 20
37     4 .1
38     1. 5
39     3 4 .
40     10 20 ..
41     10 20 .. %
42     192.168.0.1
43     10% 10.10.0.2
44     </pre>
45    
46     <table>
47     <thead>
48     <tr>
49     <th rowspan=2>Input
50     <th colspan=4>From UA processing requirements
51     <th colspan=4>From authoring requirements
52     <tr>
53     <th data-key=ua-isNothing>nothing?
54     <th data-key=ua-number1>number1
55     <th data-key=ua-number2>number2
56     <th data-key=ua-denominator>denominator
57    
58     <th data-key=author-isNothing>nothing?
59     <th data-key=author-number1>number1
60     <th data-key=author-number2>number2
61     <th data-key=author-denominator>denominator
62     <tbody>
63     </table>
64    
65     <script>
66     var testPageURL = 'test.html';
67    
68     var keys = [];
69     var resultTable = document.getElementsByTagName ('table')[0];
70     var resultHeaders = resultTable.tHead.getElementsByTagName ('th');
71     for (var i = 0; i < resultHeaders.length; i++) {
72     var th = resultHeaders[i];
73     var thKey = th.getAttribute ('data-key');
74     if (thKey) {
75     keys.push (thKey);
76     }
77     }
78     var resultRows = resultTable.tBodies[0];
79    
80     var testInputs = document.getElementById ('inputs').textContent.split (/\n/);
81    
82     var iframe = document.createElement ('iframe');
83     iframe.src = 'about:blank';
84     iframe.onload = function () {
85     runTests ();
86     };
87     document.body.appendChild (iframe);
88    
89     function runTests () {
90     if (testInputs.length) {
91     var testInput = testInputs.shift ();
92     executeTest (testInput, runTests);
93     } else {
94     document.body.removeChild (iframe);
95     }
96     } // runTests
97    
98     function executeTest (testInput, ondone) {
99     var url = testPageURL + '#' + encodeURIComponent (testInput);
100     iframe.onload = function () {
101     var doc = this.contentDocument;
102     var outputs = doc.getElementsByTagName ('output');
103     var outputValues = {};
104     for (var i = 0; i < outputs.length; i++) {
105     var output = outputs[i];
106     var name = output.getAttribute ('name') || '';
107     outputValues[name] = output.innerHTML;
108     }
109    
110     var tr = document.createElement ('tr');
111     var th = document.createElement ('th');
112     th.innerHTML = '<a><code></code></a>';
113     th.firstChild.firstChild.textContent = testInput;
114     th.firstChild.href = url;
115     tr.appendChild (th);
116     for (var i = 0; i < keys.length; i++) {
117     var key = keys[i];
118     var value = outputValues[key] || '';
119     var td = document.createElement ('td');
120     td.innerHTML = value;
121     if (key.match (/^ua-/)) {
122     var value2 = outputValues['author-' + key.substring (3)];
123     if (value != value2) {
124     td.className = 'disagree';
125     }
126     } else if (key.match (/^author-/)) {
127     var value2 = outputValues['ua-' + key.substring (7)];
128     if (value != value2) {
129     td.className = 'disagree';
130     }
131     }
132     tr.appendChild (td);
133     }
134     resultRows.appendChild (tr);
135     this.onload = function () {
136     ondone ();
137     };
138     this.src = 'about:blank';
139     };
140     iframe.src = url;
141     } // executeTest
142     </script>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24