-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: expose common base synthetic event methods (#1589)
* fix: add stup base synthetic event methods * chore: update snapshots * refactor: self code review * refactor: improvements * chore: add test
- Loading branch information
1 parent
b9c9d04
commit f7e3b1a
Showing
12 changed files
with
861 additions
and
23 deletions.
There are no files selected for viewing
168 changes: 168 additions & 0 deletions
168
src/user-event/__tests__/__snapshots__/clear.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { BaseSyntheticEvent } from 'react'; | ||
|
||
/** Builds base syntentic event stub, with prop values as inspected in RN runtime. */ | ||
export function baseSyntheticEvent(): Partial<BaseSyntheticEvent<{}, unknown, unknown>> { | ||
return { | ||
currentTarget: {}, | ||
target: {}, | ||
preventDefault: () => {}, | ||
isDefaultPrevented: () => false, | ||
stopPropagation: () => {}, | ||
isPropagationStopped: () => false, | ||
persist: () => {}, | ||
// @ts-expect-error: `isPersistent` is not a standard prop, but it's used in RN runtime. See: https://react.dev/reference/react-dom/components/common#react-event-object-methods | ||
isPersistent: () => false, | ||
timeStamp: 0, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.