25 Commits

Author SHA1 Message Date
Maciej Jastrzebski 4256d0c83c v12 release (#1314)
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
Co-authored-by: Pierre Zimmermann <64224599+pierrezimmermannbam@users.noreply.github.com>
2023-03-15 09:41:38 +01:00
Maciej Jastrzebski eb2e087002 fix: duplicate AccessibilityState type (cherry-pick of #1355) (#1361) 2023-03-07 08:00:41 +01:00
renovate[bot] 3c48c3e908 chore(deps): update dependency react-native to v0.71.3 (#1323)
* chore(deps): update dependency react-native to v0.71.3

* chore: remove @ts-expect-errors comments

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
2023-02-16 11:50:47 +01:00
Maciej Jastrzebski 47b125c195 refactor(breaking): rename container to UNSAFE_root; introduce root host element (#1298) 2023-02-14 00:32:51 +01:00
Maciej Jastrzebski 8bd19520bf chore: deprecate some a11y queries (#1226) 2023-01-28 22:31:56 +01:00
Patryk Fryda 0af721144f feat: check accessibilityLabelledBy in *ByLabelText queries (#1191)
* feat: check accessibilityLabelledBy in *ByLabelText queries

* refactor: move getNodeByText to matchTextContent helper

* test: improve getByLabelText tests

* refactor: extract matchLabelText

* refactor: tweaks

* refactor: code review changes

* refactor: code review changes

* chore: rebase on main

* chore: fix lint

* chore: fix test code in files

* chore: fix lint

* chore: fix ts error due to missing RN typing

Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
2023-01-23 23:52:24 +01:00
MattAgn 5f94d527ca byRole queries return only accessibility elements (#1244)
* refactor: group tests in accessibility

* feat: add isAccessibilityElement helper

* chore: fix typo

* feat: handle accessible in byrole

* feat: only check accessibility when useBreakingChanges true

* test: group a11y tests together

* test: add implicit accessible test

* test: review byrole test titles

* test: add test case for byRole

* refactor: code review changes

* fix: code cov warnings

Co-authored-by: Maciej Jastrzębski <mdjastrzebski@gmail.com>
2023-01-17 23:49:29 +01:00
Pierre Zimmermann d261f6100e feat(breaking): Return host component for all queries (#1234)
* 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>
2023-01-15 23:13:27 +01:00
Maciej Jastrzebski 647ae262cd fix: improve text matching (#1222) 2022-11-17 13:08:38 +01:00
Maciej Jastrzebski 527ea62623 feat: *ByRole a11y value option (#1210) 2022-11-15 16:53:10 +01:00
MattAgn c9c0493903 Add alias to hidden in query options (#1220)
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
2022-11-15 11:18:03 +01:00
MattAgn 860356be06 feat: option for queries to respect accessibility (#1064)
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
2022-11-04 22:44:50 +01:00
Shaswat Prabhat 52222b42b4 Add queryOptions to labelText and hintText (#1193)
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
2022-10-31 12:10:45 +01:00
Maciej Jastrzebski bd5ddd7bc4 fix: *ByA11yState default value false value for busy, disabled & selected state (#1166) 2022-10-21 11:06:57 +02:00
Augustin Le Fèvre 7ae763ff65 Query by role and accessibilityState and improve ByRole query errors (#1161) 2022-10-20 11:52:10 +02:00
Augustin Le Fèvre 2520735e09 fix: *ByRole queries to match their own text text content (#1139) 2022-10-04 10:06:09 +02:00
Augustin Le Fèvre c9ab3cf549 Add support for ByRole with name (#1127)
Co-authored-by: Kiran Jd <kiranjd8@gmail.com>
2022-09-22 14:34:51 +02:00
dependabot[bot] 72637c2a28 chore(deps-dev): bump @callstack/eslint-config from 12.0.2 to 13.0.1 (#1103)
* chore(deps-dev): bump @callstack/eslint-config from 12.0.2 to 13.0.1

Bumps [@callstack/eslint-config](https://github.com/callstack/eslint-config-callstack) from 12.0.2 to 13.0.1.
- [Release notes](https://github.com/callstack/eslint-config-callstack/releases)
- [Commits](https://github.com/callstack/eslint-config-callstack/commits)

---
updated-dependencies:
- dependency-name: "@callstack/eslint-config"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: run lint --fix

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
2022-09-08 17:44:26 +02:00
dependabot[bot] bfdaabc3e6 chore(deps-dev): bump @callstack/eslint-config from 11.0.0 to 12.0.2 (#950)
* chore(deps-dev): bump @callstack/eslint-config from 11.0.0 to 12.0.2

Bumps [@callstack/eslint-config](https://github.com/callstack/eslint-config-callstack) from 11.0.0 to 12.0.2.
- [Release notes](https://github.com/callstack/eslint-config-callstack/releases)
- [Commits](https://github.com/callstack/eslint-config-callstack/compare/v11.0.0...v12.0.2)

---
updated-dependencies:
- dependency-name: "@callstack/eslint-config"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: disable a11y eslint rules

* fix: formatting

* fix: flowcheck

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
2022-08-09 10:31:31 +02:00
Maciej Jastrzebski ade9f33986 refactor: remove legacy wait for options support (#1018) 2022-07-20 14:32:37 +02:00
Maciej Jastrzebski 980b3df440 chore: reenable skipped byText tests (#1017) 2022-07-20 14:08:57 +02:00
Maciej Jastrzebski 9f3b31dd9d refactor: remove deprecated byA11yStates queries (#1015) 2022-07-20 12:33:19 +02:00
MattAgn 74318854b9 Organise a11y queries by predicate (#977)
* refactor: make Options generic type optionnal in queries

* refactor: extract byLabelText queries and its tests

* refactor: extract byA11yHint queries and its tests

* refactor: extract byRole queries and its tests

* refactor: extract byA11yState queries and its tests

* refactor: extract byA11yValue queries and its tests

* refactor: extract byA11yStates queries and its tests

* refactor: harmonize component declaration in queries testsx

* refactor: simplify error helpers in queries tests

* refactor: make error helpers more explicit

* chore: remove now unused makeA11yQueries

* refactor: rename AccessibilityStateKeyQueryParam to AccessibilityStateKeys

* refactor: rename param in a11yStates

* refactor: simplify matchObject

* refactor: fix namings in labelText

* refactor: fix namings in a11yHint

* refactor: fix queryAll namings'

* refactor: fix some namings in a11yState

* refactor: fix some namings in role

* refactor: fix some namings in a11yValue

* refactor: extract matchStringValue

* refactor: extract matchObject

* refactor: extract matchArrayValue

* test: add tests for the matchers

* refactor: simplify matchArrayValue to make it more explicit

* refactor: reorder imports and object keys

* refactor: update types

* refactor: small tweaks

* refactor: tweaks

* refactor: clarify matcher naming

* refactor: add missing aliases

* chore: fix ci timeout

* chore: revert jest timeout increase

* chore: revert timeout increase

* chore: fix ci tests

* chore: re-enable disabled tests

* chore: reduce jest paralelizaiton

* chore: ci tweaks

Co-authored-by: Maciej Jastrzebski <mdjastrzebski@gmail.com>
2022-07-20 11:37:04 +02:00
Philipp Kursawe a05bf4bfa3 fix: queryByText and getByText match newlines and tabs properly (#984)
Fixes #983
2022-06-24 15:42:18 +02:00
Maciej Jastrzebski 64ff2d27c2 refactor: re-organise regular (non A11y) queries by predicate (#965)
* refactor: move queries files to queries folder

* refactor: fix import order

* refactor: extract bindByTextQueries

* refactor: extract bindByTestId, bindByDisplayValue

* refactor: extract bindByPlaceholderText

* refactor: remove findByAPI

* refactor: re-organied flow types

* refactor: migrate getByAPI & queryByAPI

* refactor: simplify query file names

* refactor: reduce external visibility

* refactor: reduce unnecessary exports

* refactor: self code review

* refactor: self code review

* refactor: move query tests to `src/queries/__tests__`

* refactor: remove removed functions errors
2022-05-04 12:08:03 +02:00