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
|
<!DOCTYPE HTML>
<html>
<head>
<title>window.console test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
</head>
<body id="body">
<script type="application/javascript">
function doTest() {
ok(window.console, "console exists");
try {
ok(!console.foo, "random property doesn't throw");
} catch (ex) {
ok(false, "random property threw: " + ex);
}
var expectedProps = {
"log": "function",
"info": "function",
"warn": "function",
"error": "function",
"exception": "function",
"debug": "function",
"trace": "function",
"dir": "function",
"group": "function",
"groupCollapsed": "function",
"groupEnd": "function",
"time": "function",
"timeLog": "function",
"timeEnd": "function",
"profile": "function",
"profileEnd": "function",
"assert": "function",
"count": "function",
"countReset": "function",
"table": "function",
"clear": "function",
"dirxml": "function",
"timeStamp": "function",
};
var foundProps = 0;
for (var prop in console) {
foundProps++;
is(typeof(console[prop]), expectedProps[prop], "expect console prop " + prop + " exists");
}
is(foundProps, Object.keys(expectedProps).length, "found correct number of properties");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
<p id="display"></p>
</body>
</html>
|