| 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 var sinon = sinon || {}; | 5 var sinon = sinon || {}; |
| 6 | 6 |
| 7 /** @type {Object} */ | 7 /** @type {Object} */ |
| 8 sinon.assert = {}; | 8 sinon.assert = {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * This is a jscompile type that can be OR'ed with the actual type to make | 68 * This is a jscompile type that can be OR'ed with the actual type to make |
| 69 * jscompile aware of the sinon.spy functions that are added to the base | 69 * jscompile aware of the sinon.spy functions that are added to the base |
| 70 * type. | 70 * type. |
| 71 * Example: Instead of specifying a type of | 71 * Example: Instead of specifying a type of |
| 72 * {function():void} | 72 * {function():void} |
| 73 * the following can be used to add the sinon.spy functions: | 73 * the following can be used to add the sinon.spy functions: |
| 74 * {(sinon.Spy|function():void)} | 74 * {(sinon.Spy|function():void)} |
| 75 * | 75 * |
| 76 * @constructor | 76 * @interface |
| 77 */ | 77 */ |
| 78 sinon.Spy = function() {}; | 78 sinon.Spy = function() {}; |
| 79 | 79 |
| 80 /** @type {number} */ | 80 /** @type {number} */ |
| 81 sinon.Spy.prototype.callCount; | 81 sinon.Spy.prototype.callCount; |
| 82 | 82 |
| 83 /** @type {boolean} */ | 83 /** @type {boolean} */ |
| 84 sinon.Spy.prototype.called = false; | 84 sinon.Spy.prototype.called; |
| 85 | 85 |
| 86 /** @type {boolean} */ | 86 /** @type {boolean} */ |
| 87 sinon.Spy.prototype.calledOnce = false; | 87 sinon.Spy.prototype.calledOnce; |
| 88 | 88 |
| 89 /** @type {boolean} */ | 89 /** @type {boolean} */ |
| 90 sinon.Spy.prototype.calledTwice = false; | 90 sinon.Spy.prototype.calledTwice; |
| 91 | 91 |
| 92 /** @type {function(...):boolean} */ | 92 /** @type {function(...):boolean} */ |
| 93 sinon.Spy.prototype.calledWith = function() {}; | 93 sinon.Spy.prototype.calledWith = function() {}; |
| 94 | 94 |
| 95 /** @type {function(number):{args:Array}} */ | 95 /** @type {function(number):{args:Array}} */ |
| 96 sinon.Spy.prototype.getCall = function(index) {}; | 96 sinon.Spy.prototype.getCall = function(index) {}; |
| 97 | 97 |
| 98 sinon.Spy.prototype.reset = function() {}; | 98 sinon.Spy.prototype.reset = function() {}; |
| 99 | 99 |
| 100 sinon.Spy.prototype.restore = function() {}; | 100 sinon.Spy.prototype.restore = function() {}; |
| 101 | 101 |
| 102 /** @type {Array<Array<*>>} */ |
| 103 sinon.Spy.prototype.args; |
| 104 |
| 102 /** | 105 /** |
| 103 * @param {Object} obj | 106 * @param {Object} obj |
| 104 * @param {string} method | 107 * @param {string} method |
| 105 * @param {Function=} opt_stubFunction | 108 * @param {Function=} opt_stubFunction |
| 106 * @return {sinon.TestStub} | 109 * @return {sinon.TestStub} |
| 107 */ | 110 */ |
| 108 sinon.stub = function(obj, method, opt_stubFunction) {}; | 111 sinon.stub = function(obj, method, opt_stubFunction) {}; |
| 109 | 112 |
| 110 /** @constructor */ | 113 /** |
| 114 * TODO(jrw): rename to |sinon.Stub| for consistency |
| 115 * @interface |
| 116 * @extends {sinon.Spy} |
| 117 */ |
| 111 sinon.TestStub = function() {}; | 118 sinon.TestStub = function() {}; |
| 112 | 119 |
| 113 /** @type {function(number):{args:Array}} */ | 120 /** @type {function(number):{args:Array}} */ |
| 114 sinon.TestStub.prototype.getCall = function(index) {}; | 121 sinon.TestStub.prototype.getCall = function(index) {}; |
| 115 | 122 |
| 116 sinon.TestStub.prototype.restore = function() {}; | 123 sinon.TestStub.prototype.restore = function() {}; |
| 117 | 124 |
| 118 /** @param {*} a */ | 125 /** @param {*} a */ |
| 119 sinon.TestStub.prototype.returns = function(a) {}; | 126 sinon.TestStub.prototype.returns = function(a) {}; |
| 120 | 127 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 * @param {!Object<string,string>} headers | 171 * @param {!Object<string,string>} headers |
| 165 * @param {?string} content | 172 * @param {?string} content |
| 166 */ | 173 */ |
| 167 sinon.FakeXhr.prototype.respond; | 174 sinon.FakeXhr.prototype.respond; |
| 168 | 175 |
| 169 /** | 176 /** |
| 170 * @param {string} event | 177 * @param {string} event |
| 171 * @param {Function} handler | 178 * @param {Function} handler |
| 172 */ | 179 */ |
| 173 sinon.FakeXhr.prototype.addEventListener; | 180 sinon.FakeXhr.prototype.addEventListener; |
| OLD | NEW |