forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fixed] OverlayTrigger passes onClick prop to child
- Loading branch information
Showing
2 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import ReactTestUtils from 'react/lib/ReactTestUtils'; | ||
import OverlayTrigger from '../src/OverlayTrigger'; | ||
|
||
describe('OverlayTrigger', function() { | ||
it('Should create OverlayTrigger element', function() { | ||
let instance = ReactTestUtils.renderIntoDocument( | ||
<OverlayTrigger overlay={<div>test</div>}> | ||
<button>button</button> | ||
</OverlayTrigger> | ||
); | ||
let overlayTrigger = instance.getDOMNode(); | ||
assert.equal(overlayTrigger.nodeName, 'BUTTON'); | ||
}); | ||
|
||
it('Should pass OverlayTrigger onClick prop to child', function() { | ||
let called = false; | ||
let callback = function() { | ||
called = true; | ||
}; | ||
let instance = ReactTestUtils.renderIntoDocument( | ||
<OverlayTrigger overlay={<div>test</div>} onClick={callback}> | ||
<button>button</button> | ||
</OverlayTrigger> | ||
); | ||
let overlayTrigger = instance.getDOMNode(); | ||
ReactTestUtils.Simulate.click(overlayTrigger); | ||
assert.equal(called, true); | ||
}); | ||
}); |