* feat: create first version of userEvent.press
* feat: do not trigger press event when pointer events is disabled
* feat: make press events bubble up when trigerring a non touch responder
* tests: add test cases for userevent.press to check calls to onPressIn and onPressOut
* refactor: move userEvent.press tests in a dedicated test file
* feat: add pressDuration option for userEvent.press
* refactor: group test that check prop calls
* feat: add support for touchable opacity for userevent press
* feat: add support for Text
* feat: add support for TextInput for userEvent.press
* refactor: add some comments to explain pointer events api
* refactor: change the api of userEvent.press to make it async
* feat: add support for real timers for userEvent.press
* refactor: create a longPress api and remove duration option from press api
* feat: add warning for users when userEvent is used with real timers
* refactor: rewrite press using common user event code
* refactor: remove duplicate pointerEventEnabled method
* refactor: remove check on fake timers in user.press
* refactor: change order of functions in press file to have exports first
* feat: add delay before press
* feat: wait min press duration before calling onPressout for text and textInput
* chore: improve coverage
* feat: account for press duration when waiting for press out
* fix: wait for press duration also when pressing text or textinput
* docs: add documentation on press and longpress
* fix: check pointer events for Text and TextInput
* chore: fixes and tweaks on userEvent docs
* Update press doc based on review suggestion
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* refactor: rename pressDuration option to duration
* Update longPress doc based on review suggestion
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* refactor: use ts doc for isPointerEventsEnabled method
* refactor: rename file isPointerEventsEnabled to pointer-events
* refactor: split test in longPress in two
* refactor: use Date.now instead of new Date().getTime()
* refactor: also test payload of events for press and longpress
* refactor: fix typo in some longpress test names
* Update src/user-event/press/utils/warnAboutRealTimers.ts
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* refactor: merge press and touch events
* fix: return after pressing text or textinput
* refactor: extract functions to trigger press on text/textInput
* refactor: use optional chaining
* feat: update warning when using userEvent with real timers
* refactor: check on press test that longPress is not called
* refactor: test directly warnings logged with real timers without mocking function
---------
Co-authored-by: pierrezimmermann <pierrez@nam.tech>
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* docs: update docs on custom jest preset
* docs: flip conditions on modern timers and react native version
* Update README.md
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* Update title in readme for custom jest preset
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
---------
Co-authored-by: pierrezimmermann <pierrez@nam.tech>
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* BREAKING CHANGE : make placeholdertext queries return host elements
* BREAKING CHANGE : make displayValue queries return host elements
* BREAKING CHANGE: make text queries return host elements
* refactor: reset config to default before each test
* feat: use component names from config and add api to configure them
* feat: remove legacy option from queries
* refactor: reorganize legacy and breaking tests for queries
* feat: change error messages for mismatching host component names
* fix: do not update screen when running auto detection
* fix: typo in comment
* refactor: use an object for matchTextContent params
* tests: rewrite some tests to match repo patterns
* fix: use legacy queries by default to prevent breaking changes
* fix: remove wrong uppercase in flow typings
* docs: remove section on useLegacy queries as it wont be a public api
* docs: small improvements based on review
* fix: remove typo in error message
* refactor: rename getReactNativeHostComponentNames to detectHostComponentNames
* refactor: use useBreakingChange from internal config instead of useLegacyQueries
* fix: use fake timers in test so it doesnt take too much time
* refactor: replace type assertions by real type checking
* fix: revert change due to rebase
* fix: improvements after review
* refactor: define type to match inside matchTextContent function
* refactor: rename function to get error message
* feat: display error when auto detect of host component names throw
* fix: remove unused ts-expect-error after ts version bump
* refactor: run auto detection on render if it hasnt been run yet
* refactor: reuse type imports that had been converted to regular ones
* refactor: add comments to distinguish breaking and legacy
* refactor: move config logic into detectComponentHostNames function
* refactor: rename function to detectComponentHostNamesIfNeeded
* tests: add test on detectHostComponentNamesIfNeeded
* fix: use host component name from config for textinput in fireEvent
* refactor: run autodetection in text, displayvalue and placeholder queries rather than in render
* refactor: remove useless async declaration
* refactor: improvements for readability from review
* Update src/__tests__/host-component-names.test.tsx
* refactor: declare variable for host component names in detection function
* refactor: rename detectHostComponentNamesIfNeeded to getHostComponentNames
* feat: use getHostComponentNames in fireEvent for textinput host name
* refactor: revert refactor on matchTextContent
* refactor: add comment to indicate impossible path
* chore: simplify jest-setup files
* refactor: code review changes
Co-authored-by: pierrezimmermann <pierrez@nam.tech>
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>