Skip to content

Commit

Permalink
Use assertions rather than a snapshot
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp Fritsche <ph.fritsche@gmail.com>
  • Loading branch information
Gudahtt and ph-fritsche committed Feb 25, 2022
1 parent 98f44ff commit 1a45005
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/clipboard/paste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,12 @@ test('does not paste when disabled', async () => {
})

test('prevent input per paste event handler', async () => {
const {element, getEventSnapshot, user} = setup(`<input />`)
const {element, eventWasFired, user} = setup(`<input />`)
element.addEventListener('paste', e => e.preventDefault())

await user.paste('hi')
expect(getEventSnapshot()).toMatchInlineSnapshot(`
Events fired on: input[value=""]
input[value=""] - paste
`)
expect(eventWasFired('paste')).toBe(true)
expect(eventWasFired('input')).toBe(false)
})

test.each(['input', 'textarea'])(
Expand Down

0 comments on commit 1a45005

Please sign in to comment.