Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
Add test for Card/Link callbacks (onBlur/onClick/onFocus)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsJonQ committed Oct 18, 2017
1 parent 84615ae commit 186c51e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/components/Card/tests/Card.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,36 @@ describe('Link', () => {
expect(b.length).toBe(1)
expect(b.node.props.children).toBe('MegaMind')
})

test('onBlur fires for a Link', () => {
const spy = jest.fn()
const wrapper = shallow(
<Card href={link} onBlur={spy} />
)
wrapper.simulate('blur')

expect(spy).toHaveBeenCalled()
})

test('onClick fires for a Link', () => {
const spy = jest.fn()
const wrapper = shallow(
<Card href={link} onClick={spy} />
)
wrapper.simulate('click')

expect(spy).toHaveBeenCalled()
})

test('onFocus fires for a Link', () => {
const spy = jest.fn()
const wrapper = shallow(
<Card href={link} onFocus={spy} />
)
wrapper.simulate('focus')

expect(spy).toHaveBeenCalled()
})
})

describe('Click', () => {
Expand Down

0 comments on commit 186c51e

Please sign in to comment.