@samitouri / QOS-React-2 / commits / 23c5332208

Fix ReactTestUtils.mockComponent so that mockTagName is not ignored.

The `mockTagName` parameter was always optional, and so probably was not used very often. If you tried to use it, it would be shadowed by the `var mockTagName` declaration in the `render` method, so only `module.mockTagName` or `"div"` were ever possible values.

Ben Newman committed Jul 18, 2014 at 10:03 UTC 23c53322083d85b19a1a3aa4f731c32482634f54
1 file changed +2 -1
src/test/ReactTestUtils.js
+2 -1
@@ -238,9 +238,10 @@ var ReactTestUtils = {
238 * @return {object} the ReactTestUtils object (for chaining)
239 */
240 mockComponent: function(module, mockTagName) {
241 + mockTagName = mockTagName || module.mockTagName || "div";
242 +
243 var ConvenienceConstructor = React.createClass({
244 render: function() {
243 - var mockTagName = mockTagName || module.mockTagName || "div";
245 return ReactDOM[mockTagName](null, this.props.children);
246 }
247 });