/[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.3 - (show annotations) (download) (as text)
Sun Oct 18 08:14:37 2009 UTC (15 years, 9 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -0 lines
File MIME type: text/html
Error occurred while calculating annotation data.
emphasizes that it is about meter, not progress :)

1 <!DOCTYPE HTML>
2 <title>&lt;meter> processing and authoring requirements</title>
3 <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 <caption><em>&lt;meter></em> Content</caption>
48 <thead>
49 <tr>
50 <th rowspan=2>Input
51 <th colspan=4>From UA processing requirements
52 <th colspan=4>From authoring requirements
53 <tr>
54 <th data-key=ua-isNothing>nothing?
55 <th data-key=ua-number1>number1
56 <th data-key=ua-number2>number2
57 <th data-key=ua-denominator>denominator
58
59 <th data-key=author-isNothing>nothing?
60 <th data-key=author-number1>number1
61 <th data-key=author-number2>number2
62 <th data-key=author-denominator>denominator
63 <tbody>
64 </table>
65
66 <script>
67 var testPageURL = 'test.html';
68
69 var keys = [];
70 var resultTable = document.getElementsByTagName ('table')[0];
71 var resultHeaders = resultTable.tHead.getElementsByTagName ('th');
72 for (var i = 0; i < resultHeaders.length; i++) {
73 var th = resultHeaders[i];
74 var thKey = th.getAttribute ('data-key');
75 if (thKey) {
76 keys.push (thKey);
77 }
78 }
79 var resultRows = resultTable.tBodies[0];
80
81 var testInputs = document.getElementById ('inputs').textContent.split (/\n/);
82
83 var iframe = document.createElement ('iframe');
84 iframe.src = 'about:blank';
85 iframe.onload = function () {
86 runTests ();
87 };
88 document.body.appendChild (iframe);
89
90 function runTests () {
91 if (testInputs.length) {
92 var testInput = testInputs.shift ();
93 executeTest (testInput, runTests);
94 } else {
95 document.body.removeChild (iframe);
96 }
97 } // runTests
98
99 function executeTest (testInput, ondone) {
100 var url = testPageURL + '#' + encodeURIComponent (testInput);
101 iframe.onload = function () {
102 var doc = this.contentDocument;
103 var outputs = doc.getElementsByTagName ('output');
104 var outputValues = {};
105 for (var i = 0; i < outputs.length; i++) {
106 var output = outputs[i];
107 var name = output.getAttribute ('name') || '';
108 outputValues[name] = output.innerHTML;
109 }
110
111 var tr = document.createElement ('tr');
112 var th = document.createElement ('th');
113 th.innerHTML = '<a><code></code></a>';
114 th.firstChild.firstChild.textContent = testInput;
115 th.firstChild.href = url;
116 tr.appendChild (th);
117 for (var i = 0; i < keys.length; i++) {
118 var key = keys[i];
119 var value = outputValues[key] || '';
120 var td = document.createElement ('td');
121 td.innerHTML = value;
122 if (key.match (/^ua-/)) {
123 var value2 = outputValues['author-' + key.substring (3)];
124 if (value != value2) {
125 td.className = 'disagree';
126 }
127 } else if (key.match (/^author-/)) {
128 var value2 = outputValues['ua-' + key.substring (7)];
129 if (value != value2) {
130 td.className = 'disagree';
131 }
132 }
133 tr.appendChild (td);
134 }
135 resultRows.appendChild (tr);
136 this.onload = function () {
137 ondone ();
138 };
139 this.src = 'about:blank';
140 };
141 iframe.src = url;
142 } // executeTest
143 </script>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24