Skip to content

Commit

Permalink
chore: upgrade to Jest 27 (#693)
Browse files Browse the repository at this point in the history
* chore: upgrade to Jest 27

* fix: ESLint config
  • Loading branch information
nickmccurdy committed Jul 17, 2021
1 parent 4029441 commit ffba2df
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -49,7 +49,7 @@
"is-ci": "^2.0.0",
"jest-in-case": "^1.0.2",
"jest-serializer-ansi": "^1.0.3",
"kcd-scripts": "^7.5.1",
"kcd-scripts": "^11.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typescript": "^4.1.2"
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/clear.js
Expand Up @@ -89,6 +89,6 @@ test('non-inputs/textareas are currently unsupported', () => {
const {element} = setup('<div />')

expect(() => userEvent.clear(element)).toThrowErrorMatchingInlineSnapshot(
`"clear currently only supports input and textarea elements."`,
`clear currently only supports input and textarea elements.`,
)
})
1 change: 1 addition & 0 deletions src/__tests__/helpers/utils.js
@@ -1,3 +1,4 @@
/* eslint-disable testing-library/no-node-access */
import {eventMap} from '@testing-library/dom/dist/event-map'
import {isElementType} from '../../utils'
// this is pretty helpful:
Expand Down
36 changes: 18 additions & 18 deletions src/__tests__/hover.js
Expand Up @@ -70,15 +70,15 @@ test('fires non-bubbling events on parents for hover', () => {
userEvent.hover(button)

expect(calls.join('\n')).toMatchInlineSnapshot(`
"BUTTON: pointerover
DIV: pointerover
DIV: pointerenter
BUTTON: pointerenter
BUTTON: mouseover
DIV: mouseover
DIV: mouseenter
BUTTON: mouseenter"
`)
BUTTON: pointerover
DIV: pointerover
DIV: pointerenter
BUTTON: pointerenter
BUTTON: mouseover
DIV: mouseover
DIV: mouseenter
BUTTON: mouseenter
`)
})

test('fires non-bubbling events on parents for unhover', () => {
Expand Down Expand Up @@ -112,15 +112,15 @@ test('fires non-bubbling events on parents for unhover', () => {
userEvent.unhover(button)

expect(calls.join('\n')).toMatchInlineSnapshot(`
"BUTTON: pointerout
DIV: pointerout
BUTTON: pointerleave
DIV: pointerleave
BUTTON: mouseout
DIV: mouseout
BUTTON: mouseleave
DIV: mouseleave"
`)
BUTTON: pointerout
DIV: pointerout
BUTTON: pointerleave
DIV: pointerleave
BUTTON: mouseout
DIV: mouseout
BUTTON: mouseleave
DIV: mouseleave
`)
})

test('throws when hovering element with pointer-events set to none', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/paste.js
Expand Up @@ -102,7 +102,7 @@ test('should give error if we are trying to call paste on an invalid element', (
const {element} = setup('<div />')
expect(() => userEvent.paste(element, "I'm only a div :("))
.toThrowErrorMatchingInlineSnapshot(`
"The given DIV element is currently unsupported.
A PR extending this implementation would be very much welcome at https://github.com/testing-library/user-event"
The given DIV element is currently unsupported.
A PR extending this implementation would be very much welcome at https://github.com/testing-library/user-event
`)
})
1 change: 1 addition & 0 deletions src/__tests__/type.js
Expand Up @@ -232,6 +232,7 @@ test('should delay the typing when opts.delay is not 0', async () => {

const text = 'Hello, world!'
const delay = 10
// eslint-disable-next-line testing-library/no-await-sync-events
await userEvent.type(element, text, {delay})

expect(onInput).toHaveBeenCalledTimes(text.length)
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/upload.js
Expand Up @@ -242,13 +242,13 @@ test('throw error if trying to use upload on an invalid element', () => {
expect(() =>
userEvent.upload(elements[0], "I'm only a div :("),
).toThrowErrorMatchingInlineSnapshot(
`"The given DIV element does not accept file uploads"`,
`The given DIV element does not accept file uploads`,
)

expect(() =>
userEvent.upload(elements[1], "I'm a checkbox :("),
).toThrowErrorMatchingInlineSnapshot(
`"The associated INPUT element does not accept file uploads"`,
`The associated INPUT element does not accept file uploads`,
)
})

Expand Down
1 change: 1 addition & 0 deletions src/__tests__/utils.js
@@ -1,3 +1,4 @@
/* eslint-disable testing-library/no-node-access */
import {screen} from '@testing-library/dom'
import {isElementType, isVisible} from '../utils'
import {setup} from './helpers/utils'
Expand Down

0 comments on commit ffba2df

Please sign in to comment.