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

Commit 58588c1

Browse files
authored
Merge pull request #4 from testing-library/pr/multiple-warning
get, find, and query throw if multiple are found
2 parents eede718 + 9c75d3d commit 58588c1

File tree

9 files changed

+25
-21
lines changed

9 files changed

+25
-21
lines changed

.all-contributorsrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"projectName": "native-testing-library-docs",
3-
"projectOwner": "bcarroll22",
3+
"projectOwner": "testing-library",
44
"repoType": "github",
55
"repoHost": "https://github.com",
66
"files": [

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ website/build/
1010
website/yarn.lock
1111
website/node_modules
1212
website/i18n/*
13+
14+
.idea/*

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
height="80"
77
width="80"
88
alt="whale"
9-
src="https://raw.githubusercontent.com/bcarroll22/native-testing-library/master/other/whale.png"
9+
src="https://raw.githubusercontent.com/testing-library/native-testing-library/master/other/whale.png"
1010
/>
1111
</a>
1212

@@ -20,14 +20,14 @@
2020
[![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)
2121
[![version](https://img.shields.io/npm/v/native-testing-library.svg?style=flat-square)](https://www.npmjs.com/package/native-testing-library)
2222
[![downloads](https://img.shields.io/npm/dm/native-testing-library.svg?style=flat-square)](http://www.npmtrends.com/native-testing-library)
23-
[![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)
23+
[![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)
2424

2525
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)
2626
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
27-
[![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)
27+
[![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)
2828

29-
[![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)
30-
[![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)
29+
[![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)
30+
[![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)
3131

3232
## Guiding Principles
3333

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

5757
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
5858
<!-- prettier-ignore -->
59-
<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>
59+
<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>
6060

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

docs/api-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fireEvent[eventName](node: FiberRoot, eventProperties: NativeEvent)
2020
```
2121

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

2626
```javascript

docs/api-queries.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sidebar_label: Queries
1111
### getBy
1212

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

1616
### getAllBy
1717

@@ -21,7 +21,8 @@ elements match.
2121
### queryBy
2222

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

2627
### queryAllBy
2728

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

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

3638
> Note, this is a simple combination of `getBy*` queries and
3739
> [`waitForElement`](/docs/api-async#waitforelement). The `findBy*` queries accept the

docs/cheat-sheet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ copy of it on your desk to quickly take a peek at the most commonly used functio
1010

1111
[Download the cheat sheet][cheatsheet]
1212

13-
[cheatsheet]: https://github.com/bcarroll22/native-testing-library/raw/master/other/cheat-sheet.pdf
13+
[cheatsheet]: https://github.com/testing-library/native-testing-library/raw/master/other/cheat-sheet.pdf

docs/ecosystem-jest-native.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: jest-native
44
sidebar_label: Jest Matchers
55
---
66

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

1010
```
@@ -27,7 +27,7 @@ expect(getByText(baseElement, 'Visible Example')).toBeVisible();
2727
> `queryByTestId`) rather than a get function (like `getByTestId`). Otherwise the `get*` function
2828
> could throw an error before your assertion.
2929
30-
Check out [jest-native's documentation](https://github.com/bcarroll22/jest-native) for a full list
30+
Check out [jest-native's documentation](https://github.com/testing-library/jest-native) for a full list
3131
of available matchers.
3232

33-
- [jest-native on GitHub](https://github.com/bcarroll22/jest-native)
33+
- [jest-native on GitHub](https://github.com/testing-library/jest-native)

website/core/Footer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Footer extends React.Component {
4545
<a href={this.docUrl('example')}>Example</a>
4646
<a href={this.docUrl('api-queries')}>API</a>
4747
<a
48-
href="https://github.com/bcarroll22/native-testing-library/raw/master/other/cheat-sheet.pdf"
48+
href="https://github.com/testing-library/native-testing-library/raw/master/other/cheat-sheet.pdf"
4949
target="_blank"
5050
rel="noreferrer noopener"
5151
>
@@ -79,8 +79,8 @@ class Footer extends React.Component {
7979
>
8080
Star
8181
</a>
82-
<a href="https://github.com/bcarroll22/native-testing-library">GitHub</a>
83-
<a href="https://github.com/bcarroll22/native-testing-library-docs">Edit the docs</a>
82+
<a href="https://github.com/testing-library/native-testing-library">GitHub</a>
83+
<a href="https://github.com/testing-library/native-testing-library-docs">Edit the docs</a>
8484
</div>
8585
</section>
8686
<section className="copyright">{this.props.config.copyright}</section>

website/siteConfig.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const siteConfig = {
3232

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

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

105105
algolia: {
106106
apiKey: 'e17df0b04917412fc03a6e92a2ca087e',

0 commit comments

Comments
 (0)