Michał Pierzchała
05db7bcaac
feat: add debug.deep and debug.shallow ( #37 )
...
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->
### Summary
Adds API proposed by https://github.com/callstack/react-native-testing-library/pull/33#issuecomment-430302079 .
Also component output is now highlighted:
<img width="259" alt="screenshot 2018-10-16 at 19 33 25" src="https://user-images.githubusercontent.com/5106466/47035614-c10efb80-d17a-11e8-99ac-00f648880008.png ">
### Test plan
Added tests for `debug`.
2018-10-16 21:45:56 +02:00
Michał Pierzchała
03e2c4b0f2
fix: use actual react-native instead of homegrown mocks ( #36 )
...
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->
### Summary
This actually uncovered some bugs, like lack of `onDoublePress` (lol XD) and enabled us to have better snapshots for deep rendering.
### Test plan
no new tests
2018-10-16 18:51:01 +02: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
Kacper Wiszczuk
a066544019
fix: Remove unnecessary flow expression ( #31 )
2018-10-15 20:57:13 +02:00
Kacper Wiszczuk
a39f879288
fix: do not bubble event to root element ( #30 )
...
Remove bubbling events to the root element as in the most common use case we pass handler prop to the root element:
```jsx
// That's usually what we do in tests
const tree = render(<SomeElement onPress={mockedHandler} />);
// Unsupported use case
const tree = render(<TouchableOpacity onPress={mockHandler()}><Text>XD</Text></TouchableOpacity>)
```
2018-10-15 17:03:30 +02:00
Kacper Wiszczuk
480dd28cbc
feat: Add Typescript types to waitForElement ( #21 )
...
Fix types for Flow too
2018-10-10 21:45:32 +02:00
Michał Pierzchała
d5219d2e93
feat: add waitForElement ( #20 )
...
* feat: add waitForElement
* add docs
* update docs
2018-10-10 21:06:06 +02:00
Michał Pierzchała
254127781c
test: add tests for shallow rendering ( #19 )
2018-10-10 17:38:20 +02:00
Michał Pierzchała
2f002014cf
fix: stack traces for get APIs ( #17 )
...
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->
### Summary
When moving `get` APIs outside of `render`, we needed to wrap them with a closure injecting `instance` to act on. This resulted in an anonymous callsite that wasn't properly processed by our `ErrorWithStack` helper.
### Test plan
|before|after|
|--|--|
|<img width="305" alt="screenshot 2018-10-07 at 16 09 27" src="https://user-images.githubusercontent.com/5106466/46582694-6fb08f00-ca4b-11e8-94f8-40dcb2211d46.png ">|<img width="491" alt="screenshot 2018-10-07 at 16 09 18" src="https://user-images.githubusercontent.com/5106466/46582698-73dcac80-ca4b-11e8-94ce-4fd16ce1f845.png ">|
2018-10-07 17:10:26 +02:00
Kacper Wiszczuk
4f0501e6b5
fix: Flow types ( #16 )
...
- [x] - Add flow to tests
- [x] - Fix flow typings
- [x] - Update documentation
2018-10-07 14:50:05 +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
Kacper Wiszczuk
d66255d482
feat: fireEvent API ( #11 )
...
Implementation of fireEvent API.
Fixes #7
2018-10-07 08:23:21 +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
Michał Pierzchała
f7f2103062
feat: improve stack traces for throwable methods
2018-10-05 00:07:55 +02:00
Michał Pierzchała
e74e928b4f
Add basic tests for render ( #8 )
2018-10-04 23:41:46 +02:00
Michał Pierzchała
e6ac5ad997
pass options to renderer; add update & unmount, rm instance & renderer
2018-10-03 20:21:20 +02:00
Michał Pierzchała
520355a645
change shallow output to be more future proof
2018-10-03 19:27:32 +02:00
Michał Pierzchała
c4a0dd7763
update readme
2018-10-03 19:15:36 +02:00
Michał Pierzchała
ac77a55068
inital commit
2018-10-01 18:15:56 +02:00