├── .gitignore ├── .prettierrc ├── LICENSE ├── README.md ├── package-lock.json ├── package.json ├── src ├── __tests__ │ ├── auto-cleanup.tsx │ ├── basic.tsx │ ├── broken-cleanup.tsx │ ├── cleanup.tsx │ ├── debug.tsx │ ├── end-to-end.tsx │ ├── events.tsx │ ├── multi-base.tsx │ ├── no-router.tsx │ ├── routes.tsx │ ├── stopwatch.tsx │ └── tsconfig.json ├── index.ts └── types.ts ├── tsconfig.json └── vitest.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | coverage -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "none", 3 | "tabWidth": 2, 4 | "semi": true, 5 | "singleQuote": false, 6 | "arrowParens": "avoid", 7 | "printWidth": 100 8 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2021 Ryan Carniato 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
Simple and complete Solid DOM testing utilities that encourage good testing 6 | practices.
7 | 8 | > Inspired completely by [preact-testing-library](https://github.com/testing-library/preact-testing-library) 9 | 10 | [](https://coveralls.io/github/ryansolid/solid-testing-library?branch=main) 11 | [](https://www.npmjs.com/package/@solidjs/testing-library) 12 | [](https://www.npmjs.com/package/solid-testing-library) 13 | [](https://discord.com/invite/solidjs) 14 | 15 |Id: {useParams()?.id}
} /> 91 |Start
} /> 92 | > 93 | ); 94 | const { findByText } = render(() =>Anyhoo
, { location: "/" }); 12 | await findByText("Anyhoo"); 13 | expect(errorMessage).toMatch("@solidjs/router"); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /src/__tests__/routes.tsx: -------------------------------------------------------------------------------- 1 | import { createSignal, catchError } from "solid-js"; 2 | import { render, fireEvent } from ".."; 3 | import { A, Route, Router, useParams } from "@solidjs/router"; 4 | 5 | describe("location option", () => { 6 | const Ids = () => ( 7 | <> 8 |Id: {useParams()?.id}
9 |10 | 11 | navigate 12 | 13 |
14 | > 15 | ); 16 | const App = () => ( 17 | <> 18 |Start
} /> 20 | > 21 | ); 22 | 23 | it("can render the main route", async () => { 24 | const { findByText } = render(() =>{state()}
; 51 | }; 52 | const { findByText } = render(() =>