Skip to content

Commit

Permalink
chore: update all deps (#513)
Browse files Browse the repository at this point in the history
* chore: update all deps

* chore: run kcd-scripts format

* chore: fix lint issues
  • Loading branch information
kentcdodds committed Dec 6, 2020
1 parent ecea19c commit 68536fb
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE.md
Expand Up @@ -33,6 +33,7 @@ supported version.
Relevant code or config

```javascript

```

What you did:
Expand Down
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -36,19 +36,19 @@
"test:debug": "kcd-scripts --inspect-brk test --runInBand",
"test:update": "npm test -- --updateSnapshot --coverage",
"validate": "kcd-scripts validate",
"typecheck": "tsc --project typings"
"typecheck": "kcd-scripts typecheck --build typings"
},
"dependencies": {
"@babel/runtime": "^7.10.2"
"@babel/runtime": "^7.12.5"
},
"devDependencies": {
"@testing-library/dom": "^7.21.4",
"@testing-library/jest-dom": "^5.11.1",
"@testing-library/dom": "^7.28.1",
"@testing-library/jest-dom": "^5.11.6",
"@types/estree": "0.0.45",
"is-ci": "^2.0.0",
"jest-serializer-ansi": "^1.0.3",
"kcd-scripts": "^6.2.3",
"typescript": "^4.0.5"
"kcd-scripts": "^7.5.1",
"typescript": "^4.1.2"
},
"peerDependencies": {
"@testing-library/dom": ">=7.21.4"
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/clear.js
Expand Up @@ -82,6 +82,7 @@ test('clears even on inputs that cannot (programmatically) have a selection', ()
const {element: number} = setup('<input value="12" type="number" />')
userEvent.clear(number)
// jest-dom does funny stuff with toHaveValue on number inputs
// eslint-disable-next-line jest-dom/prefer-to-have-value
expect(number.value).toBe('')
})

Expand Down
20 changes: 10 additions & 10 deletions src/__tests__/type.js
Expand Up @@ -425,7 +425,7 @@ test('typing into a controlled input works', () => {

userEvent.type(element, '23')

expect(element.value).toBe('$23')
expect(element).toHaveValue('$23')
expect(getEventSnapshot()).toMatchInlineSnapshot(`
Events fired on: input[value="$23"]
Expand Down Expand Up @@ -461,7 +461,7 @@ test('typing in the middle of a controlled input works', () => {

userEvent.type(element, '1')

expect(element.value).toBe('$213')
expect(element).toHaveValue('$213')
expect(getEventSnapshot()).toMatchInlineSnapshot(`
Events fired on: input[value="$213"]
Expand Down Expand Up @@ -503,7 +503,7 @@ test('ignored {backspace} in controlled input', () => {
expect(element.selectionEnd).toBe(element.value.length)
userEvent.type(element, '4')

expect(element.value).toBe('$234')
expect(element).toHaveValue('$234')
// the backslash in the inline snapshot is to escape the $ before {CURSOR}
expect(getEventSnapshot()).toMatchInlineSnapshot(`
Events fired on: input[value="$234"]
Expand Down Expand Up @@ -1108,7 +1108,7 @@ test('can type into an input with type `time`', () => {
input[value="01:05"] - change
input[value="01:05"] - keyup: 5 (53)
`)
expect(element.value).toBe('01:05')
expect(element).toHaveValue('01:05')
})

test('can type into an input with type `time` without ":"', () => {
Expand Down Expand Up @@ -1149,7 +1149,7 @@ test('can type into an input with type `time` without ":"', () => {
input[value="01:05"] - change
input[value="01:05"] - keyup: 5 (53)
`)
expect(element.value).toBe('01:05')
expect(element).toHaveValue('01:05')
})

test('can type more a number higher than 60 minutes into an input `time` and they are converted into 59 minutes', () => {
Expand Down Expand Up @@ -1195,7 +1195,7 @@ test('can type more a number higher than 60 minutes into an input `time` and the
input[value="23:59"] - keyup: 0 (48)
`)

expect(element.value).toBe('23:59')
expect(element).toHaveValue('23:59')
})

test('can type letters into an input `time` and they are ignored', () => {
Expand Down Expand Up @@ -1256,7 +1256,7 @@ test('can type letters into an input `time` and they are ignored', () => {
input[value="16:36"] - keyup: d (100)
`)

expect(element.value).toBe('16:36')
expect(element).toHaveValue('16:36')
})

test('can type a digit bigger in the hours section, bigger than 2 and it shows the time correctly', () => {
Expand Down Expand Up @@ -1299,7 +1299,7 @@ test('can type a digit bigger in the hours section, bigger than 2 and it shows t
input[value="09:25"] - keyup: 5 (53)
`)

expect(element.value).toBe('09:25')
expect(element).toHaveValue('09:25')
})

test('can type two digits in the hours section, equals to 24 and it shows the hours as 23', () => {
Expand Down Expand Up @@ -1345,7 +1345,7 @@ test('can type two digits in the hours section, equals to 24 and it shows the ho
input[value="23:52"] - keyup: 2 (50)
`)

expect(element.value).toBe('23:52')
expect(element).toHaveValue('23:52')
})

test('can type two digits in the hours section, bigger than 24 and less than 30, and it shows the hours as 23', () => {
Expand Down Expand Up @@ -1391,7 +1391,7 @@ test('can type two digits in the hours section, bigger than 24 and less than 30,
input[value="23:52"] - keyup: 2 (50)
`)

expect(element.value).toBe('23:52')
expect(element).toHaveValue('23:52')
})

test('{arrowdown} fires keyup/keydown events', () => {
Expand Down
5 changes: 5 additions & 0 deletions typings/.eslintrc
@@ -0,0 +1,5 @@
{
"parserOptions": {
"project": "./typings/tsconfig.json"
}
}
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -57,6 +57,7 @@ declare const userEvent: {
element: TargetElement,
text: string,
userOpts?: T,
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
) => T extends {delay: number} ? Promise<void> : void
tab: (userOpts?: ITabUserOptions) => void
paste: (
Expand Down
6 changes: 5 additions & 1 deletion typings/test.ts
Expand Up @@ -3,6 +3,10 @@ import userEvent, {TargetElement} from '.'
declare const element: TargetElement
type NotVoid = string | number | boolean | object | null

userEvent.type(element, 'foo', {delay: 1}) as Promise<void>
userEvent.type(element, 'foo', {delay: 1}).then(
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
function handleSucces(_nothing: void) {},
function handleError(_error: Error) {},
)
// @ts-expect-error No delay returns void
userEvent.type(element, 'foo') as NotVoid
7 changes: 2 additions & 5 deletions typings/tsconfig.json
@@ -1,7 +1,4 @@
{
"compilerOptions": {
"lib": ["dom"],
"noEmit": true,
"strict": true
}
"extends": "../node_modules/kcd-scripts/shared-tsconfig.json",
"include": ["."]
}

0 comments on commit 68536fb

Please sign in to comment.