-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_runner.html
99 lines (82 loc) · 2.52 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!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="onLoadFixture();">
<script>
var jsilConfig = {
libraryRoot: "Libraries/"
};
</script>
<script src="Libraries/JSIL.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>
<h3>Log</h3>
<div id="log">
</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 () {
document.getElementById("runscript").disabled = true;
var scriptname = document.getElementById("scriptname").value;
window.location.hash = "#" + scriptname;
contentManifest["TestRunner"] = [
["Script", scriptname]
];
onLoad();
}
function runMain () {
JSIL.Host.logWriteLine("// Test output begins here //");
var elapsed = runTestCase(function () { }, Date.now);
JSIL.Host.logWriteLine("// Test output ends here //");
JSIL.Host.logWriteLine("// Test completed in " + (elapsed / 1000) + " second(s)");
}
var lastHash = null;
function checkHash () {
var currentHash = null;
if ((typeof (window.location.hash) === "string") && (window.location.hash.length > 1)) {
currentHash = window.location.hash.substr(1);
}
if (currentHash !== lastHash) {
lastHash = currentHash;
document.getElementById("scriptname").value = currentHash;
}
}
function onLoadFixture () {
var button = document.getElementById("runscript");
checkHash();
setInterval(checkHash, 100);
button.removeAttribute("disabled");
button.addEventListener("click", runScript, true);
}
</script>
</body>
</html>