ReactLynx Testing Library is a simple and complete ReactLynx unit testing library that encourages good testing practices.
Inspired completely by react-testing-library
Similar to react-testing-library, this library is designed to test your ReactLynx components in the same way you would test React components using react-testing-library.
Setup vitest:
Then you can start writing tests and run them with vitest!
💡 Since our testing environment (@lynx-js/testing-environment
) is based on jsdom, You may also be interested in installing @testing-library/jest-dom
so you can use
the custom jest matchers.
See our examples for more usage.
重新导出 QueryByRole
重新导出 QueryByText
重新导出 QueryMethod
重新导出 WithSuggest
Namespace | 描述 |
---|---|
queries | - |
queryHelpers | - |
Class | 描述 |
---|---|
LynxTestingEnv | A pure-JavaScript implementation of the Lynx Spec, notably the Element PAPI and Dual-threaded Model for use with Node.js. |
Interface | 描述 |
---|---|
ByRoleOptions | - |
Config | - |
ConfigFn | - |
DefaultNormalizerOptions | - |
LogRolesOptions | - |
MatcherOptions | - |
NormalizerOptions | - |
PrettyDOMOptions | - |
Queries | - |
QueryOptions | - |
RenderHookOptions | The options for renderHook |
RenderHookResult | The result of renderHook |
RenderOptions | The options for render. |
Suggestion | - |
waitForOptions | - |
Type alias | 描述 |
---|---|
AllByAttribute | - |
AllByBoundAttribute | - |
AllByRole | - |
AllByText | - |
BoundFunction | - |
BoundFunctions | - |
BuiltQueryMethods | - |
ByRoleMatcher | - |
CreateFunction | - |
CreateObject | - |
ElementTree | The lynx element tree |
EventType | - |
FindAllBy | - |
FindAllByBoundAttribute | - |
FindAllByRole | - |
FindAllByText | - |
FindBy | - |
FindByBoundAttribute | - |
FindByRole | - |
FindByText | - |
FireFunction | - |
FireObject | - |
GetAllBy | - |
GetBy | - |
GetByBoundAttribute | - |
GetByRole | - |
GetByText | - |
GetErrorFunction | - |
Match | - |
Matcher | - |
MatcherFunction | - |
Method | - |
NormalizerFn | - |
Query | - |
QueryArgs | - |
QueryBy | - |
QueryByAttribute | - |
RenderResult | The result of render |
Screen | - |
Variant | - |
Variable | 描述 |
---|---|
prettyFormat | - |
screen | - |