Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed May 22, 2023
1 parent 7abbac4 commit 686a5ba
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/__tests__/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,12 @@ eventTypes.forEach(({type, events, elementType, init}) => {
const ref = React.createRef()
const spy = jest.fn()

await render(React.createElement(elementType, {
[propName]: spy,
ref,
}))
await render(
React.createElement(elementType, {
[propName]: spy,
ref,
}),
)

await fireEvent[eventName](ref.current, init)
expect(spy).toHaveBeenCalledTimes(1)
Expand Down Expand Up @@ -216,21 +218,26 @@ test('calling `fireEvent` directly works too', async () => {
const {
container: {firstChild: button},
} = await render(<button onClick={handleEvent} />)
await fireEvent(button, new Event('MouseEvent', {
bubbles: true,
cancelable: true,
button: 0,
}))
await fireEvent(
button,
new Event('MouseEvent', {
bubbles: true,
cancelable: true,
button: 0,
}),
)
})

test('blur/focus bubbles in react', async () => {
const handleBlur = jest.fn()
const handleBubbledBlur = jest.fn()
const handleFocus = jest.fn()
const handleBubbledFocus = jest.fn()
const {container} = await render(<div onBlur={handleBubbledBlur} onFocus={handleBubbledFocus}>
<button onBlur={handleBlur} onFocus={handleFocus} />
</div>)
const {container} = await render(
<div onBlur={handleBubbledBlur} onFocus={handleBubbledFocus}>
<button onBlur={handleBlur} onFocus={handleFocus} />
</div>,
)
const button = container.firstChild.firstChild

await fireEvent.focus(button)
Expand Down

0 comments on commit 686a5ba

Please sign in to comment.