|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>window.console test</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> |
|
7 </head> |
|
8 |
|
9 <body id="body"> |
|
10 |
|
11 <script type="application/javascript;version=1.8"> |
|
12 |
|
13 function doTest() { |
|
14 ok(window.console, "console exists"); |
|
15 |
|
16 try { |
|
17 ok(!console.foo, "random property doesn't throw"); |
|
18 } catch (ex) { |
|
19 ok(false, "random property threw: " + ex); |
|
20 } |
|
21 |
|
22 var expectedProps = { |
|
23 "log": "function", |
|
24 "info": "function", |
|
25 "warn": "function", |
|
26 "error": "function", |
|
27 "exception": "function", |
|
28 "debug": "function", |
|
29 "trace": "function", |
|
30 "dir": "function", |
|
31 "group": "function", |
|
32 "groupCollapsed": "function", |
|
33 "groupEnd": "function", |
|
34 "time": "function", |
|
35 "timeEnd": "function", |
|
36 "profile": "function", |
|
37 "profileEnd": "function", |
|
38 "assert": "function", |
|
39 "count": "function", |
|
40 "__noSuchMethod__": "function" |
|
41 }; |
|
42 |
|
43 var foundProps = 0; |
|
44 for (var prop in console) { |
|
45 foundProps++; |
|
46 is(typeof(console[prop]), expectedProps[prop], "expect console prop " + prop + " exists"); |
|
47 } |
|
48 is(foundProps, Object.keys(expectedProps).length, "found correct number of properties"); |
|
49 |
|
50 SimpleTest.finish(); |
|
51 } |
|
52 |
|
53 SimpleTest.waitForExplicitFinish(); |
|
54 addLoadEvent(doTest); |
|
55 |
|
56 </script> |
|
57 |
|
58 <p id="display"></p> |
|
59 |
|
60 </body> |
|
61 </html> |