Commit Graph

143 Commits

Author SHA1 Message Date
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 efc44157e2 Greenkeeper/release it 12.1.0 (#171)
* chore(package): update release-it to version 12.1.0

Closes #166

* chore(package): update lockfile yarn.lock
2019-05-14 23:36:29 +02:00
greenkeeper[bot] 3fd24c9de4 Update @callstack/eslint-config to the latest version 🚀 (#169)
* chore(package): update @callstack/eslint-config to version 6.0.0

* chore(package): update lockfile yarn.lock
2019-05-11 13:39:10 +02:00
Michał Pierzchała 0b95597f8a chore: upgrade react-native to 0.59.8 (#168)
* chore(package): update react-native to version 0.59.8

* chore(package): update lockfile yarn.lock
2019-05-08 21:17:37 +02:00
greenkeeper[bot] ab5740dd4d Update flow-bin to the latest version 🚀 (#162)
* chore(package): update flow-bin to version 0.98.0

* chore(package): update lockfile yarn.lock
2019-04-26 22:30:20 +02:00
Kacper Wiszczuk 47a780a725 fix: change link colors (#155) 2019-04-23 11:11:11 +02:00
greenkeeper[bot] 7b7518ff97 Update @callstack/eslint-config to the latest version 🚀 (#160)
* chore(package): update @callstack/eslint-config to version 5.0.0

* chore(package): update lockfile yarn.lock
2019-04-23 11:10:52 +02:00
Asday 66a4f5f347 Fixed a 404 in README.md. (#159)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

The readme's "Rally Health" link is a 404.  It appears to attempt to link to a careers page.  I skillfully sniffed out a suitable careers page by scrolling down on the 404 page and clicking "careers".

### Test plan

0. Scroll to the bottom of `README.md`;
0. Middle click on "Rally Health";
0. Bask (optional).
2019-04-23 09:10:18 +02:00
Kacper Wiszczuk 7a1c264bb0 Docs: Remove shallow API from docs (#154) 2019-04-14 17:39:11 +02:00
Michał Pierzchała e8a817cae4 docs: add and update queries documentation (#151)
### Summary

Adds new "Queries" section inspired by https://testing-library.com/docs/dom-testing-library/api-queries

### Test plan

Reading carefully
2019-04-14 16:12:50 +02:00
Kacper Wiszczuk 34eb921e21 Fix small logo in README.md (#153)
Fix small logo.
2019-04-14 15:14:19 +02:00
Kacper Wiszczuk b94fe03990 docs: Owl as RNTL logo (#152)
* imp: owl as RNTL logo

* Undo formatter mess

* Change descriptions
2019-04-14 15:04:16 +02:00
Michał Pierzchała a184c2d152 chore: add some keywords 2019-04-14 12:28:53 +02:00
Michał Pierzchała 1938a5091e chore: bump Jest, remove flaky inline snapshot (#150)
### Summary

Bumping Jest to latest, removed inline snapshot as there's a pending bug with trailing whitespaces inside of it being removed by IDEs (solution is to make them regular snapshots, but in this case the test was just plain unnecessary)

### Test plan

CI
2019-04-14 10:41:03 +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
greenkeeper[bot] 488a2ca5cc Update flow-bin to the latest version 🚀 (#148)
* chore(package): update flow-bin to version 0.97.0

* chore(package): update lockfile yarn.lock
2019-04-12 20:23:04 +02:00
Michał Pierzchała 046919c3b4 Release 1.7.0 1.7.0 2019-04-09 15:40:09 +02:00
Ferran Negre 8984abbf74 feat: being able to fire custom events that do not need to start with "on" (#147)
### Summary

If I have a custom button like:

```js
<MyCustomButton handlePress={onPress} />
```

The following will not work:

```js
fireEvent(getByTestId('my-custom-button'), 'handlePress');
```

Because we are trying to call `onHandlePress`.

### Test plan

```
yarn test fireEvent
```
2019-04-09 15:37:15 +02:00
Michał Pierzchała 55b9c67f2c Release 1.6.2 1.6.2 2019-04-03 09:13:38 +02:00
greenkeeper[bot] d3dedaa84a chore: Update flow-bin to the latest version 🚀 (#145)
* chore(package): update flow-bin to version 0.96.0

* chore(package): update lockfile yarn.lock
2019-04-02 08:35:59 +02:00
Jean-Marie Porchet 859e29c569 docs: provide example for componentDidMount (#144)
### 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 :)
2019-04-01 16:39:01 +02:00
sam freund b4cfb95893 add rally to license (#140) 2019-03-27 15:41:21 +01: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 ccad8044ea fix: check for undefined/null children (#136)
### Summary

Check for undefined/null values, in `getByText` nodes.

Fixes #135 

### Test plan

Passing tests on repro repository https://github.com/wKovacs64/rntl-161-repro.

Have no idea how to create a unit test, to test this behavior.

cc @thymikee @wKovacs64
2019-03-19 19:47:26 +01:00
Michał Pierzchała 1d5e15b230 Release 1.6.1 1.6.1 2019-03-18 15:28:19 +00:00
Eli Perkins 97ab842567 improvement: Allow for text to match children who are composed as array (#132)
### 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!
2019-03-18 16:25:13 +01:00
greenkeeper[bot] 30fcce5508 chore: update flow-bin to the latest version 🚀 (#133)
## The devDependency [flow-bin](https://github.com/flowtype/flow-bin) was updated from `0.94.0` to `0.95.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

[Find out more about this release](https://github.com/flowtype/flow-bin).

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
2019-03-16 09:18:14 +01:00
greenkeeper[bot] abd1f82898 chore: update @callstack/eslint-config to the latest version 🚀 (#134)
## The devDependency [@callstack/eslint-config](https://github.com/callstack/eslint-config-callstack) was updated from `3.0.2` to `4.0.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

[Find out more about this release](https://github.com/callstack/eslint-config-callstack).

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
2019-03-16 09:11:32 +01:00
greenkeeper[bot] ce3bf28f30 chore: update react-native to the latest version 🚀 (#130)
* chore(package): update react-native to version 0.59.0

* chore(package): update lockfile yarn.lock

* update snapshots
2019-03-12 21:06:20 +01:00
Michał Pierzchała 3e73d6f32d chore: remove excess badges that have GH support 2019-03-11 16:52:57 +01:00
Ingibjörg Ósk Jónsdóttir (Inga) 09f9b9f05a docs: Remove misleading recommendation to use shallow in snapshot tests (#128)
### 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
2019-03-07 20:55:03 +01:00
Michał Pierzchała b3abf50a10 docs: add callstack badge and note 2019-03-06 19:47:41 +01:00
Michał Pierzchała f988c3c229 chore: simple -> lightweight in README 2019-03-04 17:00:03 +01:00
Michał Pierzchała 5184f68894 Release 1.6.0 1.6.0 2019-03-04 12:54:33 +01:00
Michał Pierzchała 81f977a485 chore: use upstream types for react-test-renderer 2019-03-04 12:53:54 +01:00
David Calhoun f6c895bac5 docs: Update links (#125) 2019-03-03 08:32:00 +01:00
Michał Pierzchała 1c8eb106a5 chore: update metro and merge deps (#124)
### Summary

We have a security alert around `merge` so I bumped that, also upgraded to latest metro preset version (it's still Node 8 compatible), updated RN to 0.58.6

Removed the version check for Flow as we always use local version anyway.

### Test plan

Check build directory
2019-03-01 15:47:39 +01:00
greenkeeper[bot] b512329d94 Update flow-bin to the latest version 🚀 (#123)
## The devDependency [flow-bin](https://github.com/flowtype/flow-bin) was updated from `0.93.0` to `0.94.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

[Find out more about this release](https://github.com/flowtype/flow-bin).

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
2019-03-01 15:02:54 +01:00
Kacper Wiszczuk 11489b0e5e feat: wrap render with act() for better React Hooks support (#122) 2019-02-28 21:53:26 +01:00
Kacper Wiszczuk 747e864369 Esemesek/templates (#121)
* chore(package): update eslint to version 5.14.1

* chore(package): update lockfile yarn.lock

* Add issue templates

* Change label to 'bug report'
2019-02-23 10:28:54 +01:00
Kacper Wiszczuk 6e6d14fa43 Greenkeeper/eslint 5.14.1 (#120)
* chore(package): update eslint to version 5.14.1

* chore(package): update lockfile yarn.lock
2019-02-22 22:30:34 +01:00
greenkeeper[bot] 4f433cad59 Update flow-bin to the latest version 🚀 (#91)
## The devDependency [flow-bin](https://github.com/flowtype/flow-bin) was updated from `0.88.0` to `0.89.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

[Find out more about this release](https://github.com/flowtype/flow-bin).

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
2019-02-15 21:21:39 +01:00
Jan Hesters f35d4f5dac docs: Add note for cleanup being unnecessary (#115) 2019-02-14 19:39:36 +01:00
David Calhoun e17734f885 docs: Publish website (#113)
* docs: Remove unused commented code

Remove unused Docusaurus defaults as [requested](https://git.io/fh9po)
by [core maintainer](https://git.io/fh9p1).

* docs: Remove unused Users page

* docs: Remove unused help page

* docs: Fix website dependencies

Add required dependencies and package attributes to avoid yarn and lint
warnings.

* docs: Add StackOverflow tag

* docs: Reinstate i18n props

While additional language translations have not been created, there did
not appear to be a reason to comment these props out.

* docs: Add docs CI script

* docs: Remove unnecessary CI config
2019-02-08 14:57:53 +01:00
Michał Pierzchała 2ccadbe57f chore: bump RN dev dep to 0.58 (#110)
### Summary

Using latest RN for testing.

### Test plan

No new tests added, it's an upgrade
2019-02-06 10:12:48 +01:00
Michał Pierzchała aed1f8589d chore: bump jest to v24.1 (#109)
### Summary

Time to upgrade!

### Test plan

Green
2019-02-06 09:51:09 +01:00
Michał Pierzchała 28dcc6ff4a Add note about Rally Health 2019-01-24 16:46:17 +01:00
greenkeeper[bot] ecdcdf74ea Update release-it to the latest version 🚀 (#105)
## The devDependency [release-it](https://github.com/webpro/release-it) was updated from `9.8.1` to `10.0.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

<details>
<summary>Release Notes for Release 10.0.0</summary>

<ul>
<li>Update dev docs (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/webpro/release-it/commit/d546cc11627c7f8f4030fca2568600fc68a0b9b0/hovercard" href="https://urls.greenkeeper.io/webpro/release-it/commit/d546cc11627c7f8f4030fca2568600fc68a0b9b0"><tt>d546cc1</tt></a>)</li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 25 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/72f512caf598a906890b5d1cd56d7854700e2eb6"><code>72f512c</code></a> <code>Release 10.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/d546cc11627c7f8f4030fca2568600fc68a0b9b0"><code>d546cc1</code></a> <code>Update dev docs</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/ccc39229e6d9b65e9438d1bd093ae04eee0c062c"><code>ccc3922</code></a> <code>Release 10.0.0-rc.2</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/eda4aa80a8ffb83d79be9ed3c81942bb2d10fe0c"><code>eda4aa8</code></a> <code>Fix debug flag</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/0b222b0fac36152b12093a54db68b7b48cba61a1"><code>0b222b0</code></a> <code>Release 10.0.0-rc.1</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/c3d03330d1f24d13548423c8132a9339d0b59442"><code>c3d0333</code></a> <code>Fix registry version check for pre-releases</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/af0e39de72b888e50344edc763799791f9708b2c"><code>af0e39d</code></a> <code>Fix up tests</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/8e6100e5ebddf810a3dd8c27085004d5f283ee59"><code>8e6100e</code></a> <code>Improve consistency/clarity in gitlab/github classes</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/fb10e8993803adf50e6d15d8d167de8e0338b0f6"><code>fb10e89</code></a> <code>Bugfix for gitlab.release fallback</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/34fa22050613a32b712faacd21dab370446ae21a"><code>34fa220</code></a> <code>Release 10.0.0-rc.0</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/17d42e8036febb44c5824b37409ab087c8cd512a"><code>17d42e8</code></a> <code>Update dependencies</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/eb3c3f84b53c6d0efc15423f737e87d4465e6c91"><code>eb3c3f8</code></a> <code>Update docs</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/6164050c911a4c324644383842f76a2b747ee27f"><code>6164050</code></a> <code>Improve handling of <code>--no-git</code></code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/0f351ed7690199fb69ba97fdbb35a582a0498c79"><code>0f351ed</code></a> <code>Better handling of "obtrusive" logs</code></li>
<li><a href="https://urls.greenkeeper.io/webpro/release-it/commit/574127e8ddfd5576d8cacf08d901783129348ecd"><code>574127e</code></a> <code>Start some kind of refs doc for development</code></li>
</ul>
<p>There are 25 commits in total.</p>
<p>See the <a href="https://urls.greenkeeper.io/webpro/release-it/compare/b0d8f4b898ac92941ad3e500c4cd88d5a801605a...72f512caf598a906890b5d1cd56d7854700e2eb6">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
2019-01-17 09:41:46 +01:00
Enieber Cunha 39d2e7c8d0 chore: add links to more sample of code (#104)
* add links to more sample of code

* Update API.md

* Update API.md
2019-01-15 17:25:28 +01:00
Dana Hartweg af067d0712 docs: Add more details to the fireEvent api documentation. (#102) 2018-12-28 11:51:35 +01:00