mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
d261f6100e
* 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>
8 lines
159 B
TypeScript
8 lines
159 B
TypeScript
import { resetToDefaults } from './src/pure';
|
|
|
|
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
|
|
|
|
beforeEach(() => {
|
|
resetToDefaults();
|
|
});
|