-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix the animation delay when the first element is exposed (#12) * Resolve expose issue (#16) * Resolve expose issue * Update example * feature: Configure test env and add tests (#19) * Configure test env and add tests * Add an workflow for development * Edit build pattern * Edit example (#20) * v0.4.2
- Loading branch information
Showing
16 changed files
with
1,256 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Pull Request of development | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'dev' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn test | ||
- name: Check size limit | ||
uses: andresz1/size-limit-action@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
label: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Split Action | ||
id: prefix | ||
uses: JungWinter/[email protected] | ||
with: | ||
msg: ${{ github.head_ref }} | ||
separator: '/' | ||
|
||
- name: Add label and update title | ||
if: ${{ !startsWith(github.event.pull_request.title, steps.prefix.outputs._0) }} | ||
run: | | ||
gh pr edit ${{ github.event.pull_request.number }} --add-label ${{ steps.prefix.outputs._0 }} --title "${{ steps.prefix.outputs._0 }}: ${{ github.event.pull_request.title }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ yarn-error.log | |
.idea | ||
dist/ | ||
*.tgz | ||
coverage/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
preset: 'react-native', | ||
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'], | ||
transform: { | ||
'^.+\\.tsx?$': 'babel-jest', | ||
}, | ||
testMatch: ['**/?(*.)+(test).ts?(x)'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import {render, waitFor} from '@testing-library/react-native'; | ||
import {FormItemWrapper} from './FormItemWrapper'; | ||
import {View} from 'react-native'; | ||
|
||
const CHILD_HEIGHT = 20; | ||
const children = <View testID={'children'} style={{height: CHILD_HEIGHT}} />; | ||
|
||
describe('Render tests', function () { | ||
test('it should be shown according to change its `visible` props', async function () { | ||
const snapshot = render( | ||
<FormItemWrapper visible={false} onLayout={() => {}}> | ||
{children} | ||
</FormItemWrapper>, | ||
); | ||
|
||
expect(snapshot.getByTestId(FormItemWrapper.name).props.style.opacity).toBe( | ||
0, | ||
); | ||
|
||
snapshot.rerender( | ||
<FormItemWrapper visible={true} onLayout={() => {}}> | ||
{children} | ||
</FormItemWrapper>, | ||
); | ||
|
||
await waitFor( | ||
() => { | ||
expect( | ||
snapshot.getByTestId(FormItemWrapper.name).props.style.opacity, | ||
).toBe(1); | ||
}, | ||
{timeout: 500}, | ||
); | ||
}); | ||
}); | ||
describe('handler', function () { | ||
test('`onLayout` should be called with its height', async function () { | ||
const onLayoutMock = jest.fn(); | ||
const snapshot = render( | ||
<FormItemWrapper visible={false} onLayout={onLayoutMock}> | ||
{children} | ||
</FormItemWrapper>, | ||
); | ||
|
||
const event = { | ||
nativeEvent: { | ||
layout: { | ||
height: CHILD_HEIGHT, | ||
}, | ||
}, | ||
}; | ||
|
||
snapshot.getByTestId(FormItemWrapper.name).props.onLayout(event); | ||
|
||
await waitFor( | ||
function () { | ||
expect(onLayoutMock).toHaveBeenCalledTimes(1); | ||
expect(onLayoutMock).toHaveBeenCalledWith(event); | ||
}, | ||
{timeout: 500}, | ||
); | ||
}); | ||
}); |
Oops, something went wrong.