'use strict';
var React = require('react/addons');
var TestUtils = React.addons.TestUtils;

/**
 * Renders a component
 *
 * @method renderComponent
 * @param {ReactComponent} Component class
 * @param {Object} props used to initialize the component
 * @return {ReactElement} rendered react element
 **/
function renderComponent(Component, props) {
    var element = React.createElement(Component, props);
    return TestUtils.renderIntoDocument(element);
}

/**
 * Simulates an event triggered on given element
 *
 * @method simulateEvent
 * @param {ReactElement or DOMNode} element that will trigger the event
 * @param {String} event that will be triggered
 **/
function simulateEvent(element, event) {
    TestUtils.Simulate[event](
       element.getDOMNode ? element.getDOMNode() : element
    );
}

/**
 * Simulates an native event on given element
 *
 * @method simulateNativeEvent
 * @param {ReactElement or DOMNode} element that will trigger the event
 * @param {String} event that will be triggered
 **/
function simulateNativeEvent(element, event) {
    TestUtils.SimulateNative[event](
       element.getDOMNode ? element.getDOMNode() : element
    );
}

/**
 * Element by query selector
 *
 * @method elementQuerySelector
 * @param {ReactElement} element node where you will search
 * @param {string} query css selector
 * @return {DOMNode} the first DOM node that matches the query
 **/
function elementQuerySelector(element, query) {
    return element.getDOMNode().querySelector(query);
}

/**
 * Elements by query selector
 *
 * @method elementQuerySelectorAll
 * @param {ReactElement} element node where you will search
 * @param {String} query css selector
 * @return {DOMNode} all DOM nodes that matches the query
 **/
function elementQuerySelectorAll(element, query) {
    return element.getDOMNode().querySelectorAll(query);
}

/**
 * Creates a ComponentStub
 *
 * @method stubComponent
 * @param {ReactElement|String} tag element to create
 * @param {Object} assertProps raises an error if component props don't match
 * @return {ReactComponent} ComponentStub
 **/
function stubComponent(tag, children, showDataProps) {
    return React.createClass({
        displayName: tag.displayName || tag,

        componentWillMount: function () {
            showDataProps && this.addDataProps();
        },

        addDataProps: function () {
            Object.keys(this.props).forEach(function (key) {
                this.props['data-' + key] = this.props[key]
            }, this);
        },

        render: function () {
            return React.createElement(tag, this.props, children);
        }
    });
}

/**
 * Wraps component in a context creating component
 *
 * @method withContext
 * @param {ReactComponent} Component class
 * @return {ReactElement} react class with context setup
 **/
function withContext(context, Component) {
    var Elem = React.createFactory(Component);
    var childContextTypes = {};

    for (var key in context) {
        childContextTypes[key] = React.PropTypes.any;
    }

    return React.createClass({
        childContextTypes: childContextTypes,
        getChildContext: function () {
            return context;
        },
        render: function () {
            return Elem(this.props);
        }
    });
}

/**
 * @module helper
 **/
module.exports = {
    simulateEvent: simulateEvent,
    simulateNativeEvent: simulateNativeEvent,
    renderComponent: renderComponent,
    elementQuerySelector: elementQuerySelector,
    elementQuerySelectorAll: elementQuerySelectorAll,
    stubComponent: stubComponent,
    withContext: withContext
};

@@ -2764,28 +2764,30 @@
 eturn %7BReact
-Elem
+Compon
 ent%7D react c

Fix jsdoc param type