testing-library / testing-library/user-event

Error: Diplayed value in UI can be `null`

Open Beginner friendly
#1,290 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs assessment
Dominant language
TypeScript
Stars
2.3k
Forks
258
PR merge metrics
No merged PRs in 30d

Description

Reproduction example

null

Prerequisites

Setting a value to null programmatically.

https://github.com/testing-library/user-event/blob/63ac399e06bd8f2397a6c581915acd29235f2d38/src/document/UI.ts#L24

Expected behavior

Nothing happens

Actual behavior

TypeError: right hand side of 'in' should be an object, got null
Since EcmaScript returns object on typeof null this function is not safe

https://github.com/testing-library/user-event/blob/63ac399e06bd8f2397a6c581915acd29235f2d38/src/document/UI.ts#L24

User-event version

14.6.1

Environment

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/document/UI.ts at line 24 and reproduce the issue by setting a value to null programmatically. Check the null-handling path and verify that the operation produces no TypeError and nothing happens, as described by the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.