| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains various hacks needed to inform JSCompiler of various | 5 // This file contains various hacks needed to inform JSCompiler of various |
| 6 // QUnit-specific properties and methods. It is used only with JSCompiler to | 6 // QUnit-specific properties and methods. It is used only with JSCompiler to |
| 7 // verify the type-correctness of our code. | 7 // verify the type-correctness of our code. |
| 8 | 8 |
| 9 | 9 |
| 10 /** @type {Object} */ | 10 /** @type {Object} */ |
| 11 var QUnit = QUnit || {}; | 11 var QUnit = QUnit || {}; |
| 12 | 12 |
| 13 /** @constructor */ | 13 /** @constructor */ |
| 14 QUnit.Test = function() {}; | 14 QUnit.Test = function() {}; |
| 15 | 15 |
| 16 /** @type {QUnit.Clock} */ | 16 /** @type {QUnit.Clock} */ |
| 17 QUnit.Test.prototype.clock = new QUnit.Clock(); | 17 QUnit.Test.prototype.clock = new QUnit.Clock(); |
| 18 | 18 |
| 19 /** @constructor */ | 19 /** @constructor */ |
| 20 QUnit.Clock = function() {}; | 20 QUnit.Clock = function() {}; |
| 21 | 21 |
| 22 /** @param {number} ticks */ | 22 /** @param {number} ticks */ |
| 23 QUnit.Clock.prototype.tick = function(ticks) {}; | 23 QUnit.Clock.prototype.tick = function(ticks) {}; |
| 24 | 24 |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * @param {string} desc | 27 * @param {string} desc |
| 28 * @param {Function} f | 28 * @param {Function} f |
| 29 * @deprecated |
| 29 */ | 30 */ |
| 30 QUnit.asyncTest = function(desc, f) {}; | 31 QUnit.asyncTest = function(desc, f) {}; |
| 31 | 32 |
| 32 /** | 33 /** |
| 33 * @param {*} a | 34 * @param {*} a |
| 34 * @param {*} b | 35 * @param {*} b |
| 35 * @param {string=} opt_message | 36 * @param {string=} opt_message |
| 36 */ | 37 */ |
| 37 QUnit.deepEqual = function(a, b, opt_message) {}; | 38 QUnit.deepEqual = function(a, b, opt_message) {}; |
| 38 | 39 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 50 | 51 |
| 51 /** | 52 /** |
| 52 * @param {string} desc | 53 * @param {string} desc |
| 53 * @param {Object=} dict | 54 * @param {Object=} dict |
| 54 */ | 55 */ |
| 55 QUnit.module = function(desc, dict) {}; | 56 QUnit.module = function(desc, dict) {}; |
| 56 | 57 |
| 57 /** | 58 /** |
| 58 * @param {*} a | 59 * @param {*} a |
| 59 * @param {*} b | 60 * @param {*} b |
| 60 * @param {string} desc | 61 * @param {string=} opt_desc |
| 61 */ | 62 */ |
| 62 QUnit.notEqual = function(a, b, desc) {}; | 63 QUnit.notEqual = function(a, b, opt_desc) {}; |
| 63 | 64 |
| 64 /** | 65 /** |
| 65 * @param {boolean} cond | 66 * @param {boolean} cond |
| 66 * @param {string=} desc | 67 * @param {string=} desc |
| 67 * @return {boolean} | 68 * @return {boolean} |
| 68 */ | 69 */ |
| 69 QUnit.ok = function(cond, desc) {}; | 70 QUnit.ok = function(cond, desc) {}; |
| 70 | 71 |
| 71 QUnit.start = function() {}; | 72 QUnit.start = function() {}; |
| 72 | 73 |
| 73 /** | 74 /** |
| 74 * @param {string} desc | 75 * @param {string} desc |
| 75 * @param {Function} f | 76 * @param {function(!QUnit.Assert)} f |
| 76 */ | 77 */ |
| 77 QUnit.test = function(desc, f) {}; | 78 QUnit.test = function(desc, f) {}; |
| 78 | 79 |
| 79 /** @param {Function} f */ | 80 /** @param {Function} f */ |
| 80 QUnit.testStart = function(f) {}; | 81 QUnit.testStart = function(f) {}; |
| 81 | 82 |
| 83 /** |
| 84 * @constructor |
| 85 */ |
| 86 QUnit.Assert = function() {}; |
| 82 | 87 |
| 88 /** |
| 89 * @return {function():void} |
| 90 */ |
| 91 QUnit.Assert.prototype.async = function() {}; |
| 92 |
| 93 // TODO(jrw): Make these the primary definitions. |
| 94 QUnit.Assert.prototype.deepEqual = QUnit.deepEqual; |
| 95 QUnit.Assert.prototype.equal = QUnit.equal; |
| 96 QUnit.Assert.prototype.notEqual = QUnit.notEqual; |
| 97 QUnit.Assert.prototype.ok = QUnit.ok; |
| 98 |
| 99 /** |
| 100 * @const {!QUnit.Assert} |
| 101 */ |
| 102 QUnit.assert; |
| 103 |
| 104 // TODO(jrw): Mark these as deprecated. |
| 83 var deepEqual = QUnit.deepEqual; | 105 var deepEqual = QUnit.deepEqual; |
| 84 var equal = QUnit.equal; | 106 var equal = QUnit.equal; |
| 85 var expect = QUnit.expect; | 107 var expect = QUnit.expect; |
| 86 var module = QUnit.module; | 108 var module = QUnit.module; |
| 87 var notEqual = QUnit.notEqual; | 109 var notEqual = QUnit.notEqual; |
| 88 var ok = QUnit.ok; | 110 var ok = QUnit.ok; |
| 89 var test = QUnit.test; | 111 var test = QUnit.test; |
| OLD | NEW |