Skip to content
This repository was archived by the owner on Aug 1, 2020. It is now read-only.

get, find, and query throw if multiple are found #4

Merged
merged 2 commits into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projectName": "native-testing-library-docs",
"projectOwner": "bcarroll22",
"projectOwner": "testing-library",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ website/build/
website/yarn.lock
website/node_modules
website/i18n/*

.idea/*
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
height="80"
width="80"
alt="whale"
src="https://raw.githubusercontent.com/bcarroll22/native-testing-library/master/other/whale.png"
src="https://raw.githubusercontent.com/testing-library/native-testing-library/master/other/whale.png"
/>
</a>

Expand All @@ -20,14 +20,14 @@
[![Netlify Status](https://api.netlify.com/api/v1/badges/bb4911c5-74b1-48b4-aea8-3d317cec4761/deploy-status)](https://app.netlify.com/sites/native-testing-library/deploys)
[![version](https://img.shields.io/npm/v/native-testing-library.svg?style=flat-square)](https://www.npmjs.com/package/native-testing-library)
[![downloads](https://img.shields.io/npm/dm/native-testing-library.svg?style=flat-square)](http://www.npmtrends.com/native-testing-library)
[![MIT License](https://img.shields.io/npm/l/native-testing-library.svg?style=flat-square)](https://github.com/bcarroll22/native-testing-library/blob/master/LICENSE)
[![MIT License](https://img.shields.io/npm/l/native-testing-library.svg?style=flat-square)](https://github.com/testing-library/native-testing-library/blob/master/LICENSE)

[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![Code of Conduct](https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square)](https://github.com/bcarroll22/native-testing-library/blob/master/CODE_OF_CONDUCT.md)
[![Code of Conduct](https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square)](https://github.com/testing-library/native-testing-library/blob/master/CODE_OF_CONDUCT.md)

[![Watch on GitHub](https://img.shields.io/github/watchers/bcarroll22/native-testing-library-docs.svg?style=social)](https://github.com/bcarroll22/native-testing-library-docs/watchers)
[![Star on GitHub](https://img.shields.io/github/stars/bcarroll22/native-testing-library-docs.svg?style=social)](https://github.com/bcarroll22/native-testing-library-docs/stargazers)
[![Watch on GitHub](https://img.shields.io/github/watchers/testing-library/native-testing-library-docs.svg?style=social)](https://github.com/testing-library/native-testing-library-docs/watchers)
[![Star on GitHub](https://img.shields.io/github/stars/testing-library/native-testing-library-docs.svg?style=social)](https://github.com/testing-library/native-testing-library-docs/stargazers)

## Guiding Principles

Expand Down Expand Up @@ -56,7 +56,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<table><tr><td align="center"><a href="https://github.com/bcarroll22"><img src="https://avatars2.githubusercontent.com/u/11020406?v=4" width="100px;" alt="Brandon Carroll"/><br /><sub><b>Brandon Carroll</b></sub></a><br /><a href="https://github.com/bcarroll22/native-testing-library-docs/commits?author=bcarroll22" title="Code">💻</a> <a href="#content-bcarroll22" title="Content">🖋</a> <a href="https://github.com/bcarroll22/native-testing-library-docs/commits?author=bcarroll22" title="Documentation">📖</a> <a href="#design-bcarroll22" title="Design">🎨</a></td><td align="center"><a href="http://www.jmporchet.ch"><img src="https://avatars3.githubusercontent.com/u/3099008?v=4" width="100px;" alt="Jean-Marie Porchet"/><br /><sub><b>Jean-Marie Porchet</b></sub></a><br /><a href="https://github.com/bcarroll22/native-testing-library-docs/commits?author=jmporchet" title="Documentation">📖</a></td><td align="center"><a href="http://santiagomartin.dev"><img src="https://avatars2.githubusercontent.com/u/7255298?v=4" width="100px;" alt="Santi"/><br /><sub><b>Santi</b></sub></a><br /><a href="https://github.com/bcarroll22/native-testing-library-docs/commits?author=SantiMA10" title="Documentation">📖</a></td></tr></table>
<table><tr><td align="center"><a href="https://github.com/bcarroll22"><img src="https://avatars2.githubusercontent.com/u/11020406?v=4" width="100px;" alt="Brandon Carroll"/><br /><sub><b>Brandon Carroll</b></sub></a><br /><a href="https://github.com/testing-library/native-testing-library-docs/commits?author=bcarroll22" title="Code">💻</a> <a href="#content-bcarroll22" title="Content">🖋</a> <a href="https://github.com/testing-library/native-testing-library-docs/commits?author=bcarroll22" title="Documentation">📖</a> <a href="#design-bcarroll22" title="Design">🎨</a></td><td align="center"><a href="http://www.jmporchet.ch"><img src="https://avatars3.githubusercontent.com/u/3099008?v=4" width="100px;" alt="Jean-Marie Porchet"/><br /><sub><b>Jean-Marie Porchet</b></sub></a><br /><a href="https://github.com/testing-library/native-testing-library-docs/commits?author=jmporchet" title="Documentation">📖</a></td><td align="center"><a href="http://santiagomartin.dev"><img src="https://avatars2.githubusercontent.com/u/7255298?v=4" width="100px;" alt="Santi"/><br /><sub><b>Santi</b></sub></a><br /><a href="https://github.com/testing-library/native-testing-library-docs/commits?author=SantiMA10" title="Documentation">📖</a></td></tr></table>

<!-- ALL-CONTRIBUTORS-LIST:END -->

Expand Down
2 changes: 1 addition & 1 deletion docs/api-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fireEvent[eventName](node: FiberRoot, eventProperties: NativeEvent)
```

Convenience methods for firing events. Check out
[src/events.js](https://github.com/bcarroll22/native-testing-library/blob/master/src/events.js) for
[src/events.js](https://github.com/testing-library/native-testing-library/blob/master/src/events.js) for
a full list as well as `validTargets` for every event type.

```javascript
Expand Down
8 changes: 5 additions & 3 deletions docs/api-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sidebar_label: Queries
### getBy

`getBy*` queries returns the first matching node for a query, and throws an error if no elements
match.
match or if more than one match is found (use `getAllBy` instead).

### getAllBy

Expand All @@ -21,7 +21,8 @@ elements match.
### queryBy

`queryBy*` queries returns the first matching node for a query, and return `null` if no elements
match. This is useful for asserting an element is not present.
match. This is useful for asserting an element is not present. This throws if more than one match is
found (use `queryAllBy` instead)..

### queryAllBy

Expand All @@ -31,7 +32,8 @@ match. This is useful for asserting an element is not present.
### findBy

`findBy*` queries return a promise which resolves when an element is found which matches the given
query. The promise is rejected if no element is found after a default timeout of `4500`ms.
query. The promise is rejected if no element is found or if more than one element is found after a
default timeout of `4500`ms. If you need to find more than one element, then use `findAllBy`.

> Note, this is a simple combination of `getBy*` queries and
> [`waitForElement`](/docs/api-async#waitforelement). The `findBy*` queries accept the
Expand Down
2 changes: 1 addition & 1 deletion docs/cheat-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ copy of it on your desk to quickly take a peek at the most commonly used functio

[Download the cheat sheet][cheatsheet]

[cheatsheet]: https://github.com/bcarroll22/native-testing-library/raw/master/other/cheat-sheet.pdf
[cheatsheet]: https://github.com/testing-library/native-testing-library/raw/master/other/cheat-sheet.pdf
6 changes: 3 additions & 3 deletions docs/ecosystem-jest-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: jest-native
sidebar_label: Jest Matchers
---

[`jest-native`](https://github.com/bcarroll22/jest-native) is a companion library for
[`jest-native`](https://github.com/testing-library/jest-native) is a companion library for
`native-testing-library` that provides custom element matchers for Jest.

```
Expand All @@ -27,7 +27,7 @@ expect(getByText(baseElement, 'Visible Example')).toBeVisible();
> `queryByTestId`) rather than a get function (like `getByTestId`). Otherwise the `get*` function
> could throw an error before your assertion.

Check out [jest-native's documentation](https://github.com/bcarroll22/jest-native) for a full list
Check out [jest-native's documentation](https://github.com/testing-library/jest-native) for a full list
of available matchers.

- [jest-native on GitHub](https://github.com/bcarroll22/jest-native)
- [jest-native on GitHub](https://github.com/testing-library/jest-native)
6 changes: 3 additions & 3 deletions website/core/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Footer extends React.Component {
<a href={this.docUrl('example')}>Example</a>
<a href={this.docUrl('api-queries')}>API</a>
<a
href="https://github.com/bcarroll22/native-testing-library/raw/master/other/cheat-sheet.pdf"
href="https://github.com/testing-library/native-testing-library/raw/master/other/cheat-sheet.pdf"
target="_blank"
rel="noreferrer noopener"
>
Expand Down Expand Up @@ -79,8 +79,8 @@ class Footer extends React.Component {
>
Star
</a>
<a href="https://github.com/bcarroll22/native-testing-library">GitHub</a>
<a href="https://github.com/bcarroll22/native-testing-library-docs">Edit the docs</a>
<a href="https://github.com/testing-library/native-testing-library">GitHub</a>
<a href="https://github.com/testing-library/native-testing-library-docs">Edit the docs</a>
</div>
</section>
<section className="copyright">{this.props.config.copyright}</section>
Expand Down
6 changes: 3 additions & 3 deletions website/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const siteConfig = {

// Used for publishing and more
projectName: 'native-testing-library-docs',
organizationName: 'bcarroll22',
organizationName: 'testing-library',
// For top-level user or org sites, the organization is still the same.
// e.g., for the https://JoelMarcey.github.io site, it would be set like...
// organizationName: 'JoelMarcey'
Expand Down Expand Up @@ -98,9 +98,9 @@ const siteConfig = {

// You may provide arbitrary config keys to be used as needed by your
// template. For example, if you need your repo's URL...
repoUrl: 'https://github.com/bcarroll22/native-testing-library',
repoUrl: 'https://github.com/testing-library/native-testing-library',
docsRepoUrl: 'https://github.com/bcarroll2/native-testing-library-docs',
editUrl: 'https://github.com/bcarroll22/native-testing-library-docs/blob/master/docs/',
editUrl: 'https://github.com/testing-library/native-testing-library-docs/blob/master/docs/',

algolia: {
apiKey: 'e17df0b04917412fc03a6e92a2ca087e',
Expand Down