diff --git a/docs/rules/prefer-user-event.md b/docs/rules/prefer-user-event.md index 421a0875..d0df0434 100644 --- a/docs/rules/prefer-user-event.md +++ b/docs/rules/prefer-user-event.md @@ -118,6 +118,7 @@ The following table lists all the possible equivalents from the low-level API `f | ---------------- | ----------------------------------------------------------------------------------------------------------- | | `click` | | | `change` | | +| `changeText` | | | `dblClick` | | | `input` | | | `keyDown` | | @@ -138,3 +139,5 @@ The following table lists all the possible equivalents from the low-level API `f | `pointerOut` | | | `pointerOver` | | | `pointerUp` | | +| `press` | | +| `scroll` | | diff --git a/lib/rules/prefer-user-event.ts b/lib/rules/prefer-user-event.ts index daf408d1..ccfeb435 100644 --- a/lib/rules/prefer-user-event.ts +++ b/lib/rules/prefer-user-event.ts @@ -24,6 +24,8 @@ export const UserEventMethods = [ 'hover', 'unhover', 'paste', + 'press', + 'scrollTo', ] as const; type UserEventMethodsType = (typeof UserEventMethods)[number]; @@ -31,6 +33,7 @@ type UserEventMethodsType = (typeof UserEventMethods)[number]; export const MAPPING_TO_USER_EVENT: Record = { click: ['click', 'type', 'selectOptions', 'deselectOptions'], change: ['upload', 'type', 'clear', 'selectOptions', 'deselectOptions'], + changeText: ['type'], dblClick: ['dblClick'], input: ['type', 'upload', 'selectOptions', 'deselectOptions', 'paste'], keyDown: ['type', 'tab'], @@ -51,6 +54,8 @@ export const MAPPING_TO_USER_EVENT: Record = { pointerOut: ['unhover'], pointerOver: ['hover', 'selectOptions', 'deselectOptions'], pointerUp: ['click', 'dblClick', 'selectOptions', 'deselectOptions'], + press: ['press'], + scroll: ['scrollTo'], }; function buildErrorMessage(fireEventMethod: string) {