Repository navigation
Expand file tree
/
Copy pathtests.html
More file actions
282 lines (240 loc) · 10.1 KB
/
Copy pathtests.html
File metadata and controls
282 lines (240 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Tent Test Page</title>
<style type='text/css'>
body {
font-family: fixedsys, consolas, monospace;
}
h1 {
text-align: center;
width: 500px;
margin-bottom: 5px;
}
#controlPanel {
width: 500px;
text-align: center;
vertical-align: middle;
padding: 10px;
margin-top: 0px;
height: 50px;
}
#footer {
text-align: center;
vertical-align: middle;
padding: 60px;
color: #888888;
}
#browser {
padding: 0px;
color: #888888;
font-size: smaller;
}
#btnStart {
font-size: x-large;
}
#btnLoad {
font-size: x-large;
}
#status {
font-weight: bold;
padding: 10px;
}
#status.success {
background: #66FF66;
}
#status.failed {
background: red;
color: white;
}
.log table {
border: none;
}
.log td.eventMessage {
max-width: 980px;
word-break: break-all;
}
.log tr.evenrow .eventMessage {
background-color: #e5e5e5;
padding-right: 50px;
}
.log .eventType {
font-weight: bold;
}
.log .eventType {
padding-right: 10px;
text-align: right;
}
.log .eventlevelinfo .eventType {
color: blue;
}
.log .eventleveltrace {
color: gray;
}
.log .eventleveldebug {
color: gray;
}
.log .eventlevelwarn {
color: #EE9900;
}
.log .eventlevelerror {
color: red;
}
.log .eventlevelfatal {
color: red;
}
</style>
</head>
<body>
<script type="text/javascript" src="tools/jquery.min.js">
</script>
<script type="text/javascript" src="tools/test/tests.js">
</script>
<script type="text/javascript" src="tools/test/Asserts.js">
</script>
<h1>Tent Test Page</h1>
<div id="controlPanel">
<span id="status">choose source</span>
<div id="codesourcepanel" style="display:inline;">
<input id="loadminified" name="codesource" type="radio" value="dist" checked="checked"/>minified <input name="codesource" type="radio" value="src"/>source folder
</div><input id="btnLoad" type="button" value="Load" onclick="loadTest();"/><input id="btnStart" type="button" disabled="true" value="Run" style="display:none;" onclick="startTest();"/>
</div>
<div id="browser" title="Current UserAgent">
</div>
<h2>Log</h2>
<div id="logOutput" class="log">
<table id="logItems">
<thead>
<th>
Event Type
</th>
<th>
Message
</th>
</thead>
<tbody>
</tbody>
</table>
</div>
<div id="footer">
Tent Test Page - 2011
</div>
<script type="text/javascript">
var logCount = 0;
var scriptsLoaded = false;
var addToLog = function(message, level){
var levelName;
if (typeof tent == 'undefined') {
levelName = (level || 'ERROR').toUpperCase();
}
else {
levelName = tent.logging.Levels.getName(level).toUpperCase();
}
var tr = document.createElement('tr');
var cssclass = 'eventRow eventlevel' +
levelName.toLowerCase() +
(logCount % 2 == 0 ? ' evenrow' : '');
tr.setAttribute('class', cssclass);
var td1 = document.createElement('td');
td1.setAttribute('class', 'eventType');
$(td1).text(levelName);
tr.appendChild(td1);
var td2 = document.createElement('td');
td2.setAttribute('class', 'eventMessage');
$(td2).html($('<div/>').text(message).html().replace(/(\s)/g, ' '));
tr.appendChild(td2);
var tbody = document.getElementById('logItems').tBodies[0];
tbody.appendChild(tr);
logCount++;
}
var loadTest = function(){
if (scriptsLoaded) {
alert('scripts already loaded');
return;
}
var btnLoad, btnStart, txtStatus;
try {
btnLoad = document.getElementById('btnLoad');
btnLoad.disabled = 'true';
btnLoad.parentNode.removeChild(btnLoad);
txtStatus = document.getElementById('status');
txtStatus.innerText = 'Loading...';
document.getElementById('codesourcepanel').style.display = 'none';
var onSourceLoaded = function(files){
if (typeof tent == 'undefined') {
addToLog('Error loading library, check browser console', 'FATAL');
document.getElementById('status').innerText = 'Error';
document.getElementById('status').setAttribute('class', 'failed');
}
tent.log.bind(addToLog);
tent.log.info('Source loaded (' + files.length + ' files)');
tests.scripts.loadList('src/testfilelist.js', 'src-test', function(files){
tent.log.info('Tests loaded (' + files.length + ' files, ' + tests.cases.length + ' test cases)');
scriptsLoaded = true;
document.getElementById('btnStart').disabled = '';
document.getElementById('btnStart').style.display = '';
document.getElementById('status').innerText = 'Ready';
});
}
try {
if (document.getElementById('loadminified').checked) {
// load minified version
tests.scripts.load('dist/tent.js' + '?' + Math.random(), function(data, textStatus){
onSourceLoaded(['dist/tent.js']);
});
}
else {
// load from src folder
tests.scripts.loadList('src/srcfilelist.js', 'src', onSourceLoaded);
}
}
catch (error) {
document.getElementById('status').innerText = 'Error';
document.getElementById('status').setAttribute('class', 'failed');
if (typeof tent == 'undefined') {
addToLog('Error loading scripts: ' + error, 'FATAL');
}
else {
tent.log.fatal('Error loading scripts: ' + error);
}
}
}
catch (error) {
addToLog(error + '')
}
}
var startTest = function(){
if (!scriptsLoaded) {
alert('scripts not loaded');
return;
}
var btnStart, txtStatus;
try {
txtStatus = document.getElementById('status');
txtStatus.innerText = 'Running...';
btnStart = document.getElementById('btnStart');
btnStart.disabled = 'true';
btnStart.parentNode.removeChild(btnStart);
tests.runAsync(function(){
if (tests.succeeded) {
tent.log.info('All tests completed successfully! (' + tests.elapsed + 'ms)');
txtStatus.innerText = 'Success!';
txtStatus.setAttribute('class', 'success');
}
else {
tent.log.error('Tests failed, errors: ' + tests.errors + ' (' + tests.elapsed + 'ms)');
txtStatus.innerText = 'Failed';
txtStatus.setAttribute('class', 'failed');
}
});
}
catch (error) {
tent.log.fatal(error + '');
}
}
document.getElementById('browser').innerText = navigator.userAgent;
addToLog('test engine ready', 'INFO');
</script>
</body>
</html>