Skip to content

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ph-fritsche committed Jan 1, 2022
1 parent 6565146 commit 3c1ef55
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion tests/pointer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ test('only pointer events on disabled elements', async () => {
'<button disabled />',
)

await userEvent.pointer([{target: element}, {keys: '[MouseLeft]'}])
await userEvent.pointer([
{target: element},
{keys: '[MouseLeft]'},
{target: element, keys: '[TouchA]'},
])

expect(getEventSnapshot()).toMatchInlineSnapshot(`
Events fired on: button
Expand All @@ -123,6 +127,12 @@ test('only pointer events on disabled elements', async () => {
button - pointermove
button - pointerdown
button - pointerup
button - pointerover
button - pointerenter
button - pointerdown
button - pointerup
button - pointerout
button - pointerleave
`)

expect(eventWasFired('pointerover')).toBe(true)
Expand Down
3 changes: 2 additions & 1 deletion tests/pointer/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test('move focus to closest focusable element', async () => {
await userEvent.pointer({keys: '[MouseLeft>]', target: element.children[1]})
expect(element.children[1]).toHaveFocus()

await userEvent.pointer({keys: '[MouseLeft>]', target: element.children[0]})
await userEvent.pointer({keys: '[TouchA]', target: element.children[0]})
expect(element).toHaveFocus()
})

Expand All @@ -35,6 +35,7 @@ test('mousedown handlers can prevent moving focus', async () => {
element.addEventListener('mousedown', e => e.preventDefault())

await userEvent.pointer({keys: '[MouseLeft>]', target: element})
await userEvent.pointer({keys: '[TouchA]', target: element})

expect(element).not.toHaveFocus()
expect(element).toHaveProperty('selectionStart', 0)
Expand Down

0 comments on commit 3c1ef55

Please sign in to comment.