Skip to content

Commit

Permalink
feat: add userEvent.tripleClick API
Browse files Browse the repository at this point in the history
  • Loading branch information
ph-fritsche committed Nov 2, 2021
1 parent 07bf49b commit 7108cab
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/click/tripleClick.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import userEvent from '#src'
import { getUISelection } from '#src/document'
import { setup } from '#testHelpers/utils'

test('select input per triple click', () => {
const { element, getEventSnapshot} = setup<HTMLInputElement>(`<input value="foo bar"/>`)

userEvent.tripleClick(element)

expect(element).toHaveFocus()
expect(getUISelection(element)).toEqual({selectionStart: 0, selectionEnd: 7})

expect(getEventSnapshot()).toMatchInlineSnapshot()
})

0 comments on commit 7108cab

Please sign in to comment.