mirror of
https://github.com/rive-app/rive-react.git
synced 2026-03-13 08:22:30 +08:00
Compare commits
3 Commits
v4.25.1
...
ci/fix-ver
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3af6b41f17 | ||
|
|
76fe777fb1 | ||
|
|
a958bdaa72 |
@@ -6,9 +6,14 @@
|
||||
|
||||

|
||||
|
||||
A React runtime library for [Rive](https://rive.app).
|
||||
[Rive](https://rive.app) combines an interactive design tool, a new stateful graphics format, a lightweight multi-platform runtime, and a blazing-fast vector renderer. This end-to-end pipeline guarantees that what you build in the Rive Editor is exactly what ships in your apps, games, and websites.
|
||||
|
||||
This library is a wrapper around the [JS/Wasm runtime](https://github.com/rive-app/rive-wasm), giving full control over the js runtime while providing components and hooks for React applications.
|
||||
For more information, check out the following resources:
|
||||
|
||||
- [Homepage](https://rive.app/)
|
||||
- [General Docs](https://rive.app/docs/)
|
||||
- [React Docs](https://rive.app/docs/runtimes/react/react)
|
||||
- [Rive Community / Support](https://community.rive.app/c/support/)
|
||||
|
||||
## Table of contents
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
"@testing-library/jest-dom": "^5.13.0",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"@types/node": "^18.17.0",
|
||||
"@types/offscreencanvas": "^2019.6.4",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/testing-library__jest-dom": "^5.9.5",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { mocked } from 'jest-mock';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
|
||||
import useStateMachineInput from '../src/hooks/useStateMachineInput';
|
||||
@@ -35,6 +34,7 @@ function getRiveMock({
|
||||
const riveMock = new Rive({
|
||||
canvas: undefined as unknown as HTMLCanvasElement,
|
||||
});
|
||||
|
||||
if (smiInputs) {
|
||||
riveMock.stateMachineInputs = jest.fn().mockReturnValue(smiInputs);
|
||||
}
|
||||
@@ -51,8 +51,6 @@ describe('useStateMachineInput', () => {
|
||||
it('returns null if there is no state machine name', () => {
|
||||
const riveMock = getRiveMock();
|
||||
|
||||
mocked(Rive).mockImplementation(() => riveMock);
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
useStateMachineInput(riveMock, '', 'testInput')
|
||||
);
|
||||
@@ -71,10 +69,8 @@ describe('useStateMachineInput', () => {
|
||||
it('returns null if there are no inputs for the state machine', () => {
|
||||
const riveMock = getRiveMock({ smiInputs: [] });
|
||||
|
||||
mocked(Rive).mockImplementation(() => riveMock);
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
useStateMachineInput(riveMock as Rive, 'smName', '')
|
||||
useStateMachineInput(riveMock, 'smName', '')
|
||||
);
|
||||
expect(result.current).toBeNull();
|
||||
});
|
||||
@@ -85,8 +81,6 @@ describe('useStateMachineInput', () => {
|
||||
} as StateMachineInput;
|
||||
const riveMock = getRiveMock({ smiInputs: [smInput] });
|
||||
|
||||
mocked(Rive).mockImplementation(() => riveMock);
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
useStateMachineInput(riveMock, 'smName', 'numInput')
|
||||
);
|
||||
@@ -99,8 +93,6 @@ describe('useStateMachineInput', () => {
|
||||
} as StateMachineInput;
|
||||
const riveMock = getRiveMock({ smiInputs: [smInput] });
|
||||
|
||||
mocked(Rive).mockImplementation(() => riveMock);
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
useStateMachineInput(riveMock, 'smName', 'boolInput')
|
||||
);
|
||||
@@ -113,7 +105,6 @@ describe('useStateMachineInput', () => {
|
||||
value: false,
|
||||
} as StateMachineInput;
|
||||
const riveMock = getRiveMock({ smiInputs: [smInput] });
|
||||
mocked(Rive).mockImplementation(() => riveMock);
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
useStateMachineInput(riveMock, 'smName', 'boolInput', true)
|
||||
|
||||
Reference in New Issue
Block a user