-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_runner.html
76 lines (60 loc) · 1.88 KB
/
test_runner.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<title>JSIL Test Runner</title>
<style>
body, button, input {
font-family: Calibri, Tahoma, Verdana, sans-serif;
font-size: 14pt;
}
label {
font-weight: bold;
display: inline-block;
width: 10em;
}
input[type="text"] {
width: 20em;
}
button {
width: 10em;
}
</style>
</head>
<body onload="onLoad()">
<script src="Libraries/JSIL.Core.js" type="text/javascript"></script>
<script src="Libraries/JSIL.Bootstrap.js" type="text/javascript"></script>
<label for="scriptname">Test Script To Run:</label> <input type="text" name="scriptname" id="scriptname" value="Tests/SimpleTestCases/If.js"></input><br>
<button id="runscript" name="runscript">Run</button>
<hr>
<div id="loadedscripts"></div>
<script type="text/javascript">
var _started = Date.now();
function print (text) {
console.log(text);
}
function timeout (t) {
// no-op
}
function elapsed (t) {
return Date.now() - _started;
}
function runScript () {
var scriptname = document.getElementById("scriptname").value;
var onError = function () {
alert("Failed to load script.");
};
var elt = document.createElement("script");
elt.type = "text/javascript";
elt.addEventListener("error", onError, true);
elt.async = true;
var container = document.getElementById("loadedscripts");
container.innerHTML = "";
container.appendChild(elt);
elt.src = scriptname;
}
function onLoad () {
document.getElementById("runscript").addEventListener("click", runScript, true);
}
</script>
</body>
</html>