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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 /** @constructor */ | 55 /** @constructor */ |
56 sinon.Mock = function() {}; | 56 sinon.Mock = function() {}; |
57 | 57 |
58 /** | 58 /** |
59 * @param {string} method | 59 * @param {string} method |
60 * @return {sinon.Expectation} | 60 * @return {sinon.Expectation} |
61 */ | 61 */ |
62 sinon.Mock.prototype.expects = function(method) {}; | 62 sinon.Mock.prototype.expects = function(method) {}; |
63 | 63 |
| 64 /** |
| 65 * @return {void} |
| 66 */ |
| 67 sinon.Mock.prototype.restore = function() {}; |
| 68 |
64 /** @type {function(...):Function} */ | 69 /** @type {function(...):Function} */ |
65 sinon.spy = function() {}; | 70 sinon.spy = function() {}; |
66 | 71 |
67 /** | 72 /** |
68 * This is a jscompile type that can be OR'ed with the actual type to make | 73 * 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 | 74 * jscompile aware of the sinon.spy functions that are added to the base |
70 * type. | 75 * type. |
71 * Example: Instead of specifying a type of | 76 * Example: Instead of specifying a type of |
72 * {function():void} | 77 * {function():void} |
73 * the following can be used to add the sinon.spy functions: | 78 * the following can be used to add the sinon.spy functions: |
(...skipping 22 matching lines...) Expand all Loading... |
96 sinon.Spy.prototype.getCall = function(index) {}; | 101 sinon.Spy.prototype.getCall = function(index) {}; |
97 | 102 |
98 sinon.Spy.prototype.reset = function() {}; | 103 sinon.Spy.prototype.reset = function() {}; |
99 | 104 |
100 sinon.Spy.prototype.restore = function() {}; | 105 sinon.Spy.prototype.restore = function() {}; |
101 | 106 |
102 /** @type {Array<Array<*>>} */ | 107 /** @type {Array<Array<*>>} */ |
103 sinon.Spy.prototype.args; | 108 sinon.Spy.prototype.args; |
104 | 109 |
105 /** | 110 /** |
106 * @param {Object} obj | 111 * @param {Object=} opt_obj |
107 * @param {string} method | 112 * @param {string=} opt_method |
108 * @param {Function=} opt_stubFunction | 113 * @param {Function=} opt_stubFunction |
109 * @return {sinon.TestStub} | 114 * @return {sinon.TestStub} |
110 */ | 115 */ |
111 sinon.stub = function(obj, method, opt_stubFunction) {}; | 116 sinon.stub = function(opt_obj, opt_method, opt_stubFunction) {}; |
112 | 117 |
113 /** | 118 /** |
114 * TODO(jrw): rename to |sinon.Stub| for consistency | 119 * TODO(jrw): rename to |sinon.Stub| for consistency |
115 * @interface | 120 * @interface |
116 * @extends {sinon.Spy} | 121 * @extends {sinon.Spy} |
117 */ | 122 */ |
118 sinon.TestStub = function() {}; | 123 sinon.TestStub = function() {}; |
119 | 124 |
120 /** @type {function(number):{args:Array}} */ | 125 /** @type {function(number):{args:Array}} */ |
121 sinon.TestStub.prototype.getCall = function(index) {}; | 126 sinon.TestStub.prototype.getCall = function(index) {}; |
122 | 127 |
123 sinon.TestStub.prototype.restore = function() {}; | 128 sinon.TestStub.prototype.restore = function() {}; |
124 | 129 |
125 /** @param {*} a */ | 130 /** @param {*} a */ |
126 sinon.TestStub.prototype.returns = function(a) {}; | 131 sinon.TestStub.prototype.returns = function(a) {}; |
127 | 132 |
128 /** @type {function(...):sinon.Expectation} */ | 133 /** @type {function(...):sinon.Expectation} */ |
129 sinon.TestStub.prototype.withArgs = function() {}; | 134 sinon.TestStub.prototype.withArgs = function() {}; |
130 | 135 |
131 /** @type {function(...):sinon.Expectation} */ | 136 /** @type {function(...):sinon.Expectation} */ |
132 sinon.TestStub.prototype.onFirstCall = function() {}; | 137 sinon.TestStub.prototype.onFirstCall = function() {}; |
133 | 138 |
| 139 /** @type {function(...):sinon.Expectation} */ |
| 140 sinon.TestStub.prototype.callsArgWith = function() {}; |
| 141 |
134 /** @returns {Object} */ | 142 /** @returns {Object} */ |
135 sinon.createStubInstance = function (/** * */ constructor) {}; | 143 sinon.createStubInstance = function (/** * */ constructor) {}; |
136 | 144 |
137 /** @interface */ | 145 /** @interface */ |
138 sinon.FakeXhrCtrl = function() {}; | 146 sinon.FakeXhrCtrl = function() {}; |
139 | 147 |
140 /** | 148 /** |
141 * @type {?function(!sinon.FakeXhr)} | 149 * @type {?function(!sinon.FakeXhr)} |
142 */ | 150 */ |
143 sinon.FakeXhrCtrl.prototype.onCreate; | 151 sinon.FakeXhrCtrl.prototype.onCreate; |
(...skipping 27 matching lines...) Expand all Loading... |
171 * @param {!Object<string,string>} headers | 179 * @param {!Object<string,string>} headers |
172 * @param {?string} content | 180 * @param {?string} content |
173 */ | 181 */ |
174 sinon.FakeXhr.prototype.respond; | 182 sinon.FakeXhr.prototype.respond; |
175 | 183 |
176 /** | 184 /** |
177 * @param {string} event | 185 * @param {string} event |
178 * @param {Function} handler | 186 * @param {Function} handler |
179 */ | 187 */ |
180 sinon.FakeXhr.prototype.addEventListener; | 188 sinon.FakeXhr.prototype.addEventListener; |
OLD | NEW |