* detectHostComponentNames: render test tree inside act to avoid timer leaks
* chore: tweaks
* refactor: extract common renderWithAct function
* chore: tweaks
---------
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* Flush all pending microtasks and updates before returning from waitFor
* Disable a linter error, its advice is not good
* refactor: use `flushMicroTasks` util
* refactor: add legacy fake timer test
* refactor: tweaks
---------
Co-authored-by: Maciej Jastrzębski <mdjastrzebski@gmail.com>
* fix: force cast await to proper type
* fix: ci
* refactor: remove support for mock act
* refactor: tweaks
* chore: remove unused test
* chore: fix lint
* refactor: code review changes
* 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>
* fix: do not use a real timeout in waitfor when using fake timers
* refactor: rewrite test so that it is more explicit
* refactor: make test faster by decreasing both interval and timeout
* refactor: expect waitFor to throw rather than wrapping in try catch
* test: fix typo in test comment
* tests: increase a bit interval so test is more robust and make it more explicit
* tests: some improvements from review
* Update expect comment following review suggestion
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
Co-authored-by: pierrezimmermann <pierrez@nam.tech>
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* Add support for testing with react@17
* Test with react@17 through a script updating dependencies
* Use test:ci command also for react@17
* Minor adjustements to script
* Update scripts/test_react_17
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* fix: prevent non editable textinputs from being updated through getByTestID
* refactor: add comment to explain double check in isTextInput function
* Update src/__tests__/fireEvent.test.tsx
* Update src/__tests__/fireEvent.test.tsx
Co-authored-by: pierrezimmermann <pierrez@nam.tech>
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
* Trigger non-touch events on box-none targets
Currently, this library disables _all_ events for a target with
`pointerEvents="box-none"`. This behavior is counter to how React Native
itself functions. This change continues to disable touch events, e.g.
`press`, for targets set to "box-none", but allows triggering non-touch
events, e.g. `layout`, `touchStart`.
* Event triggers target box-none View instead of child
This approach more closely aligns with the original failing test case.
* Rename events in test description
Attempt to better communicate the test is focused on ensuring that touch
events continue to trigger (e.g. `touchStart`), but the final event from
a touch tap does not trigger.
* chore: update jest
* refactor: pass useFakeTimer config in tests
* refactor: remove unused code
* fix jest config unable to discover babel due to rootDir change
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>