Skip to content

Commit

Permalink
tests(DropdownItem): add onClick handler test (reactstrap#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasco authored and TheSharpieOne committed May 21, 2018
1 parent 3561e3c commit 1d20d6d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/__tests__/DropdownItem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,23 @@ describe('DropdownItem', () => {
expect(onClick).toHaveBeenCalled();
});

it('should call onClick prop', () => {
toggle = jest.fn();
const clickHandler = jest.fn();
const wrapper = mount(
<DropdownItem onClick={clickHandler}>Click me</DropdownItem>,
{
context: {
toggle: toggle
}
}
);

wrapper.simulate('click');
expect(clickHandler).toHaveBeenCalled();
expect(toggle).toHaveBeenCalled();
});

it('should call toggle', () => {
toggle = jest.fn();
const wrapper = mount(
Expand Down

0 comments on commit 1d20d6d

Please sign in to comment.