diff --git a/src/ModalTrigger.js b/src/ModalTrigger.js
index 6afea34271..facb1414a1 100644
--- a/src/ModalTrigger.js
+++ b/src/ModalTrigger.js
@@ -49,12 +49,13 @@ const ModalTrigger = React.createClass({
render() {
let child = React.Children.only(this.props.children);
- return cloneElement(
- child,
- {
- onClick: createChainedFunction(child.props.onClick, this.toggle)
- }
- );
+ let props = {};
+
+ props.onClick = createChainedFunction(child.props.onClick, this.toggle);
+ props.onMouseOver = createChainedFunction(child.props.onMouseOver, this.props.onMouseOver);
+ props.onMouseOut = createChainedFunction(child.props.onMouseOut, this.props.onMouseOut);
+
+ return cloneElement(child, props);
}
});
diff --git a/test/ModalTriggerSpec.js b/test/ModalTriggerSpec.js
new file mode 100644
index 0000000000..1f90db52fd
--- /dev/null
+++ b/test/ModalTriggerSpec.js
@@ -0,0 +1,45 @@
+import React from 'react';
+import ReactTestUtils from 'react/lib/ReactTestUtils';
+import ModalTrigger from '../src/ModalTrigger';
+
+describe('ModalTrigger', function() {
+ it('Should create ModalTrigger element', function() {
+ let instance = ReactTestUtils.renderIntoDocument(
+ test}>
+
+
+ );
+ let modalTrigger = instance.getDOMNode();
+ assert.equal(modalTrigger.nodeName, 'BUTTON');
+ });
+
+ it('Should pass ModalTrigger onMouseOver prop to children', function() {
+ let called = false;
+ let callback = function() {
+ called = true;
+ };
+ let instance = ReactTestUtils.renderIntoDocument(
+ test} onMouseOver={callback}>
+
+
+ );
+ let modalTrigger = instance.getDOMNode();
+ ReactTestUtils.Simulate.mouseOver(modalTrigger);
+ assert.equal(called, true);
+ });
+
+ it('Should pass ModalTrigger onMouseOut prop to children', function() {
+ let called = false;
+ let callback = function() {
+ called = true;
+ };
+ let instance = ReactTestUtils.renderIntoDocument(
+ test} onMouseOut={callback}>
+
+
+ );
+ let modalTrigger = instance.getDOMNode();
+ ReactTestUtils.Simulate.mouseOut(modalTrigger);
+ assert.equal(called, true);
+ });
+});