* Redux example
* Reviews implemented
* Redux integration example
* Update docs/ReduxIntegration.md
* Update docs/ReduxIntegration.md
* Resolution of reviews put in by @thymikee
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
* Proof of concept - CodeSandbox embed
* Prettier fix
* Moved examples below API Reference
* Created the examples directory
Includes react-navigation example
* Article on React Navigation
* Specify rootDir for testing
Prevents CI to run example tests
* remove jest-transform-stub and identity-obj-proxy, add transformIgnorePatterns
* update docs
* rearrange
* remove non-essential files
* rename Navigation -> AppNavigator
* reword comment
* add links and explanations
* remove index file, because it's not an app anyway
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
* Fix unclear sentence and misuse of word 'stand'
This sentence was not very clear. Also, the word 'stand' was used, but I think the word 'understand' was what was intended.
The sentence has been updated to convey what I think was the intended meaning.
* Update docs/GettingStarted.md
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
<!-- 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
### Summary
Some people find it useful to search for specific terms when browsing the docs.
Specifying the concrete utility of the `update` method makes the doc more useful :)
### 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).
### Summary
Given a component that renders text by composing together literal text with an inline expression for a dynamic variable, React Native will render this as a `<Text>` element with multiple children. For example:
```js
const BananaCounter = ({ numBananas }) => (
<Text>There are {numBananas} bananas in the bunch</Text>
);
const { toJSON, debug } = render(<BananaCounter numBananas={3} />);
debug();
/*
<Text>
There are
3
bananas in the bunch
</Text>
*/
expect(toJSON()).toMatchInlineSnapshot(`
<Text>
There are
3
bananas in the bunch
</Text>
`);
```
This makes sense, as the component is a:
- literal string
- a dynamic evaluation
- literal string
Unfortunately, this means that writing a test that finds an element based on that dynamic evaluation fails when using `getByText`.
```js
const { getByText } = render(<BananaCounter numBananas={3} />);
expect(getByText('There are 3 bananas in the bunch')).toBeTruthy(); // Fails
```
This is because we compare the given test string directly against `children`. https://github.com/callstack/react-native-testing-library/blob/ce3bf28f308728672bc5502e120048821c60218b/src/helpers/getByAPI.js#L23-L24
This results in comparing `'There are 3 bananas in the bunch' === ['There are ' 3, ' bananas in the bunch']`, which of course will fail.
The solution is to join children and compare the joined result against the given text string.
### Test plan
A test for this new functionality is provided!
### Summary
I removed misleading recommendation to render components with `shallow` in snapshot tests as a result of the conversation in Issue #127.
### Test plan
Review text in API.md
### Summary
There is a helper that exists in `react-testing-library` to query inputs by their `placeholder`. This PR adds that support.
You **could** achieve this by querying for a `placeholder` prop, or querying for react native `TextInput`s manually and then checking their props, but it felt cleaner to have this contained in the testing library itself. It will also allow you to bypass any other instances that may have a `placeholder` prop that aren't `TextInput`s.
If we don't want to expand the surface of the library further, I completely understand that and am fine with this being closed. Just seems like it may be useful and save some time for several scenarios =)
### Test plan
+ Render a `TextInput` with a `placeholder` prop
+ Query the test instance via `getByPlaceholder` for the input
+ Verify the test instance is found
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->
### Summary
Whoopsie
### Test plan
<!-- List the steps with which we can test this change. Provide screenshots if this changes anything visual. -->
* Run docusaurus init
* Add api.md and remove initial files
* Run docusaurus init
* Add api.md and remove initial files
* Add callstack info and remove extra scripts
* Commeent out extra features on home page and Add link to example
* Re Arrange Docs Folder
* add some adjustments
* fix lint
* fix lint
<!-- 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.