-
Notifications
You must be signed in to change notification settings - Fork 2
/
eventtests.html
54 lines (49 loc) · 1.45 KB
/
eventtests.html
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
<!DOCTYPE html>
<html>
<head>
<title>Event test suite</title>
</head>
<body>
<h1>Event test suite</h1>
<div id="status"></div>
<div id="errors"></div>
<div id="info"></div>
<pre>
<script type="text/javascript" src="global.js"></script>
<script type="text/javascript" src="global-es5.js"></script>
<script type="text/javascript" src="extensions.js"></script>
<script type="text/javascript" src="require.js"></script>
<script type="text/javascript">
define("timeouts", { setTimeout: window.setTimeout,
clearTimeout: window.clearTimeout });
</script>
<script type="text/javascript">
define('main', ['html-escape','eventtests'], function(html_escape,eventtests) {
var errors = "", infos = "";
function error(str) {
console.log("ERROR", str);
//document.write("ERROR: "+str+"\n");
errors += "<li>"+html_escape(str)+"</li>\n";
}
function info(str) {
//document.write("INFO: "+str+"\n");
infos += "<li>"+html_escape(str)+"</li>\n";
}
eventtests(info, error);
function fill(elem_id, h1, contents, no_escape) {
if (!no_escape) contents = html_escape(contents);
elem = document.getElementById(elem_id);
elem.innerHTML = "<h2>" + h1 + "</h2>\n" + contents;
}
fill('status', errors ? 'Failed.' : 'Success!', '');
// put infos and errors into appropriate elements
if (infos) {
fill('info', 'Informational messages', '<ul>'+infos+'</ul>', true);
}
if (errors) {
fill('errors', 'Errors', '<ol>'+errors+'</ol>', true);
}
});
</script>
</pre>
</body> </html>