|
1 | 1 |
|
2 | 2 | (function () {
|
3 | 3 |
|
| 4 | + var CONSOLE_LOG_SUPPORTED = ('console' in window) && console.log; |
| 5 | + var CONSOLE_GROUP_SUPPORTED = ('console' in window) && console.group && |
| 6 | + console.groupEnd; |
| 7 | + var CONSOLE_LOG_APPLY = true; |
| 8 | + |
4 | 9 | function info() {
|
5 |
| - console.log.apply(console, arguments); |
| 10 | + if (CONSOLE_LOG_APPLY) { |
| 11 | + console.log.apply(console, arguments); |
| 12 | + } else { |
| 13 | + console.log(arguments); |
| 14 | + } |
6 | 15 | }
|
7 | 16 |
|
8 |
| - // Fall back when we don't have the console. |
9 |
| - // TODO: Find a different way of logging in old IEs. |
10 |
| - if (!('console' in window) || !console.log) { |
11 |
| - info = function () {}; |
| 17 | + if (!CONSOLE_LOG_SUPPORTED) { |
| 18 | + info = Prototype.emptyFunction; |
| 19 | + } else { |
| 20 | + try { |
| 21 | + console.log.apply(console, [""]); |
| 22 | + } catch (e) { |
| 23 | + CONSOLE_LOG_APPLY = false; |
| 24 | + } |
12 | 25 | }
|
13 |
| - window.info = info; |
14 | 26 |
|
15 |
| - var CONSOLE_GROUP_SUPPORTED = ('console' in window) && console.group && |
16 |
| - console.groupEnd; |
| 27 | + window.info = info; |
17 | 28 |
|
18 | 29 | // A function that acts like setTimeout, except with arguments reversed. This
|
19 | 30 | // is far more readable within tests.
|
|
193 | 204 | // tests run, then detach them all from the document. Then, before a suite
|
194 | 205 | // runs, its fixtures are reattached, then removed again before the next
|
195 | 206 | // suite runs.
|
| 207 | + // |
196 | 208 | window.Test = {
|
197 | 209 | setup: function () {
|
198 | 210 | var body = $(document.body);
|
|
211 | 223 | startSuite: function (suite) {
|
212 | 224 | if (CONSOLE_GROUP_SUPPORTED) {
|
213 | 225 | console.group('Suite:', suite);
|
| 226 | + } else if (CONSOLE_LOG_SUPPORTED) { |
| 227 | + console.log('Suite:', suite); |
214 | 228 | }
|
215 | 229 |
|
216 | 230 | if (this.currentFixtures && this.currentFixtures.parentNode) {
|
|
0 commit comments