| 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 /** |
| 6 // QUnit-specific properties and methods. It is used only with JSCompiler to | 6 * @fileoverview JSCompiler externs for QUnit. |
| 7 // verify the type-correctness of our code. | 7 * @externs |
| 8 */ |
| 9 |
| 10 /** |
| 11 * namespace |
| 12 * @const |
| 13 */ |
| 14 var QUnit = {}; |
| 8 | 15 |
| 9 | 16 |
| 10 /** @type {Object} */ | 17 /** |
| 11 var QUnit = QUnit || {}; | 18 */ |
| 19 QUnit.start = function() {}; |
| 12 | 20 |
| 13 /** @constructor */ | |
| 14 QUnit.Test = function() {}; | |
| 15 | 21 |
| 16 /** @type {QUnit.Clock} */ | 22 /** |
| 17 QUnit.Test.prototype.clock = new QUnit.Clock(); | 23 */ |
| 24 QUnit.stop = function() {}; |
| 25 |
| 26 |
| 27 /** |
| 28 * @param {string} name |
| 29 * @param {function(!QUnit.Assert)} testFunction |
| 30 */ |
| 31 QUnit.test = function(name, testFunction) {}; |
| 32 |
| 33 |
| 34 |
| 35 /** |
| 36 * @constructor |
| 37 */ |
| 38 QUnit.Assert = function() {}; |
| 39 |
| 40 |
| 41 /** |
| 42 * @param {number} assertionCount |
| 43 */ |
| 44 QUnit.Assert.prototype.expect = function(assertionCount) {}; |
| 45 |
| 18 | 46 |
| 19 /** @constructor */ | 47 /** @constructor */ |
| 20 QUnit.Clock = function() {}; | 48 QUnit.Clock = function() {}; |
| 21 | 49 |
| 50 |
| 22 /** @param {number} ticks */ | 51 /** @param {number} ticks */ |
| 23 QUnit.Clock.prototype.tick = function(ticks) {}; | 52 QUnit.Clock.prototype.tick = function(ticks) {}; |
| 24 | 53 |
| 25 /** @param {Function} f */ | |
| 26 QUnit.testStart = function(f) {}; | |
| 27 | |
| 28 /** @param {Function} f */ | |
| 29 QUnit.testDone = function(f) {}; | |
| 30 /** | |
| 31 * @interface | |
| 32 */ | |
| 33 QUnit.Assert = function() {}; | |
| 34 | |
| 35 /** | |
| 36 * @return {function():void} | |
| 37 */ | |
| 38 QUnit.Assert.prototype.async = function() {}; | |
| 39 | 54 |
| 40 /** | 55 /** |
| 41 * @param {*} a | 56 * @param {*} a |
| 42 * @param {*} b | 57 * @param {*} b |
| 43 * @param {string=} opt_desc | 58 * @param {string=} opt_desc |
| 44 */ | 59 */ |
| 45 QUnit.Assert.prototype.notEqual = function(a, b, opt_desc) {}; | 60 QUnit.Assert.prototype.notEqual = function(a, b, opt_desc) {}; |
| 46 | 61 |
| 62 |
| 47 /** | 63 /** |
| 48 * @param {*} cond Passes if cond is truthy. | 64 * @param {*} a |
| 49 * @param {string=} desc | 65 * @param {*} b |
| 50 * @return {boolean} | 66 * @param {string=} opt_message |
| 51 */ | 67 */ |
| 52 QUnit.Assert.prototype.ok = function(cond, desc) {}; | 68 QUnit.Assert.prototype.strictEqual = function(a, b, opt_message) {}; |
| 69 |
| 70 |
| 71 /** |
| 72 * @param {boolean} condition |
| 73 * @param {string=} opt_message |
| 74 */ |
| 75 QUnit.Assert.prototype.ok = function(condition, opt_message) {}; |
| 76 |
| 77 |
| 78 /** |
| 79 * @return {function():void} |
| 80 */ |
| 81 QUnit.Assert.prototype.async = function() {}; |
| 82 |
| 53 | 83 |
| 54 /** | 84 /** |
| 55 * @param {*} a | 85 * @param {*} a |
| 56 * @param {*} b | 86 * @param {*} b |
| 57 * @param {string=} opt_message | 87 * @param {string=} opt_message |
| 58 */ | 88 */ |
| 59 QUnit.Assert.prototype.deepEqual = function(a, b, opt_message) {}; | 89 QUnit.Assert.prototype.deepEqual = function(a, b, opt_message) {}; |
| 60 | 90 |
| 61 /** | |
| 62 * @param {*} a | |
| 63 * @param {*} b | |
| 64 * @param {string=} opt_message | |
| 65 */ | |
| 66 QUnit.Assert.prototype.equal = function(a, b, opt_message) {}; | |
| 67 | |
| 68 /** | |
| 69 * @param {number} assertionCount | |
| 70 */ | |
| 71 QUnit.Assert.prototype.expect = function(assertionCount) {}; | |
| 72 | |
| 73 /** | |
| 74 * @param {*} a | |
| 75 * @param {*} b | |
| 76 * @param {string=} opt_message | |
| 77 */ | |
| 78 QUnit.Assert.prototype.strictEqual = function(a, b, opt_message) {}; | |
| 79 | 91 |
| 80 /** | 92 /** |
| 81 * @param {function()} a | 93 * @param {function()} a |
| 82 * @param {*=} opt_b | 94 * @param {*=} opt_b |
| 83 * @param {string=} opt_message | 95 * @param {string=} opt_message |
| 84 */ | 96 */ |
| 85 QUnit.Assert.prototype.throws = function(a, opt_b, opt_message) {}; | 97 QUnit.Assert.prototype.throws = function(a, opt_b, opt_message) {}; |
| 86 | 98 |
| 99 |
| 100 /** |
| 101 * @param {*} a |
| 102 * @param {*} b |
| 103 * @param {string=} opt_message |
| 104 */ |
| 105 QUnit.Assert.prototype.equal = function(a, b, opt_message) {}; |
| 106 |
| 107 |
| 108 /** @param {Function} f */ |
| 109 QUnit.testStart = function(f) {}; |
| 110 |
| 111 |
| 112 /** @param {Function} f */ |
| 113 QUnit.testDone = function(f) {}; |
| 114 |
| 115 |
| 87 /** | 116 /** |
| 88 * @typedef {{ | 117 * @typedef {{ |
| 89 * beforeEach: (function(!QUnit.Assert) | undefined), | 118 * beforeEach: (function(!QUnit.Assert) | undefined), |
| 90 * afterEach: (function(!QUnit.Assert) | undefined) | 119 * afterEach: (function(!QUnit.Assert) | undefined) |
| 91 * }} | 120 * }} |
| 92 */ | 121 */ |
| 93 QUnit.ModuleArgs; | 122 QUnit.ModuleArgs; |
| 94 | 123 |
| 124 |
| 95 /** | 125 /** |
| 96 * @param {string} desc | 126 * @param {string} desc |
| 97 * @param {QUnit.ModuleArgs=} opt_args= | 127 * @param {QUnit.ModuleArgs=} opt_args= |
| 98 */ | 128 */ |
| 99 QUnit.module = function(desc, opt_args) {}; | 129 QUnit.module = function(desc, opt_args) {}; |
| 100 | |
| 101 /** | |
| 102 * @param {string} desc | |
| 103 * @param {function(!QUnit.Assert)} f | |
| 104 */ | |
| 105 QUnit.test = function(desc, f) {}; | |
| 106 | |
| 107 /** | |
| 108 * @param {string} desc | |
| 109 * @param {function(!QUnit.Assert)} f | |
| 110 */ | |
| 111 QUnit.skip = function(desc, f) {}; | |
| OLD | NEW |