-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
41 lines (36 loc) · 1.61 KB
/
test.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
<html>
<head>
<script src="bcrypt.js" type="text/javascript"></script>
<title>bcrypt test</title>
<script type="text/javascript">
function runTests() {
var result = false,
errors = false;
document.getElementById("status").innerHTML = "Running tests... Please wait.";
document.getElementById("status").style.color = "black";
try {
result = bcrypt.runTests();
} catch(x) {
errors = true;
if (typeof x.error === "string") {
document.getElementById("status").innerHTML = x.error;
document.getElementById("status").style.color = "red";
} else {
document.getElementById("status").innerHTML = "Unknown error while running the tests.";
document.getElementById("status").style.color = "red";
}
}
if ((result !== true) && (errors === false)) {
document.getElementById("status").innerHTML = "Unknown error while running the tests.";
document.getElementById("status").style.color = "red";
} else if (result === true) {
document.getElementById("status").innerHTML = "All tests passed";
document.getElementById("status").style.color = "green";
}
}
</script>
</head>
<body onload="runTests() && true">
<h1 id="status"></h1>
</body>
</html>