13 Commits

Author SHA1 Message Date
Michał Pierzchała 29ce4f2b48 chore: bump eslint config to latest (#308)
* chore: bump eslint config to latest

* lint fix

* lint pass

* use roles directly
2020-05-15 10:10:49 +02:00
Maciej Jastrzebski ab34712133 feat: add findBy* queries (#304)
* Basic async findBy queries

* Refactored findBy queries to be built with makeFindQuery

* findBy queries for A11y selectors

* Custom findByTestId implementation that avoids current getByTestId issues

* Fixed prettier issue

* Updates Queries.md with findBy queries

* Trying to fix test timeout error appearing only on CI

* Code review changes

* Added typescript types & tests

* prettier did reformat some code arround

* Removed export of GetByAPI, QueryByAPI and FindByAPI interfaces in TS

* Reversed prettier run on typings

* Added overlapping pieces with `within` operator

* Small cleanup

* Update website/docs/Queries.md

* Moved async/await tests to the end of test methods

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
2020-05-15 09:52:33 +02:00
Alec Larson 4c77f4a7dc feat: add "cleanup" function (#237)
* feat: add "cleanup" function

* docs: add "cleanup" section

* test: "cleanup" function

* don't expose cleanup queue


Co-authored-by: Alec Larson <alec.stanford.larson@gmail.com>
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
2019-12-09 11:41:48 +01:00
Scotty Waggoner f6f0a7091d feat: Add wrapper option to render (#173)
* Add wrapper option to render

* Update TS types and call updateWithAct only once

* wrapUiIfNeeded -> wrap

* reindent snapshots

* adjustments

* change name
2019-05-28 22:31:48 +02:00
Kacper Wiszczuk f9bc0b263d feat: add a11y queries (#178)
* First implementation of matcher generator

* A11y queries added

* extract prepareErrorMessage

* Add tests

* Make aliases

* Move create queryByError

* Add missing aliases

* simplify valid node check

* add docs

* fix types
2019-05-28 20:47:06 +02:00
Michał Pierzchała 439db6c823 feat: add rerender as an alias for update (#149)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

Users of `react-testing-library` use `rerender` wording instead of `update`. Let's make it easier for them by aliasing it.
See: https://testing-library.com/docs/react-testing-library/api#rerender

### Test plan

Added cases for JS tests and TS typings
2019-04-14 10:09:46 +02:00
Brad f96d782d26 Improvement: Add act to update call to support hooks (#137)
### Summary
Currently `render` and `fireEvent` are wrapped in `act` to support hooks. This pull request wraps the update call in `act` to support testing component updates (e.g. prop changes).

### Test plan
* I have added a test for update in `__tests__/act.test.js`.
* A useEffect hook should run again on `update` calls (if the hook dependency array is satisfied).
2019-03-25 15:22:34 +01:00
Kacper Wiszczuk 11489b0e5e feat: wrap render with act() for better React Hooks support (#122) 2019-02-28 21:53:26 +01:00
Michał Pierzchała c5910d94e4 fix: remove deprecated existential Flow type and use any for now (#77)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

Existential type (`*`) is long deprecated, let's just use `any` for now.

### Test plan

Added some more Flow typings to `shallow.test.js` that were failing because of existential type.
2018-11-28 12:49:15 +01:00
Michał Pierzchała 909916e84c feat: add debug to render helpers for easier console debugging (#65)
* feat: add debug to render helpers for easier console debugging

* bring back toJSON to docs

* revert unnecessary change

* update TS

* remove cyclic dependency of debug <-> render
2018-11-19 13:51:38 +01:00
Michał Pierzchała 07d3be1c51 feat: add toJSON to render; cleanup shallow (#35)
* feat: add toJSON to render; cleanup shallow

* Remove empty dependencies entry

* revert shallow import

* add docs

* add TS typings
2018-10-16 18:00:54 +02:00
Michał Pierzchała 495811bd08 feat: add query API (#13)
* feat: add query API

* use plural for API

* return empty array from queryAll

* fix wording in readme

* move mass exports to get/query files
2018-10-07 10:59:27 +02:00
Michał Pierzchała 9d14406832 BREAKING: make getAllBy* methods throwable (#12)
* BREAKING: make getAllBy* methods throwable

* fix wrong fn args
2018-10-06 23:42:52 +02:00