You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+108-110
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,31 @@
1
1
# Svelte Cartesian
2
2
3
-
A single component that helps render prop combinations (the "Cartesian
4
-
Product") for visual regression testing.
3
+
A single component that helps render prop combinations. It can be used with visual regression test software such as [Playwright](https://playwright.dev/)
4
+
or [Storybook](https://storybook.js.org/) (see [examples](#examples)).
5
+
6
+
Its name comes from "Cartesian Product" in which an intersection of two
<imgsrc="https://raw.githubusercontent.com/theetrain/svelte-cartesian/main/demo.jpg"alt="Cartesian demonstration featuring a 4 x 3 x 2 combination." />
7
14
8
15
-[Why](#why)
9
16
-[Before using `svelte-cartesian`](#before-using-svelte-cartesian)
10
17
-[After using `svelte-cartesian`](#after-using-svelte-cartesian)
11
-
-[Svelte 4 usage](#svelte-4-usage)
12
-
-[Basic usage (Svelte 4)](#basic-usage-svelte-4)
13
-
-[Usage with slots (Svelte 4)](#usage-with-slots-svelte-4)
|_default_|`let:innerProps`| Default slot. Contents get passed to provided `Component`. When `asChild` is set to `true`, contents **MAY** contain provided `Component` and its respective slots; see [usage with slots](#usage-with-slots-svelte-4) for more details. |
178
+
|`label`|`let:label`, `let:innerProps`| Provide your own label, styles, and logic instead of the default provided label. |
179
+
180
+
## Adding labels
174
181
175
182
Use the `labels` prop to generate labels next to every component instance.
|`divAttributes`|`?SvelteHTMLElements["div"]={}`| Attributes to be spread onto the wrapping `<div>` element. |
274
-
| `let:innerProps` | `Record<string, any>` | Provides a single combination of props at every iteration to the *default* slot. Use this alongside `asChild` to spread `innerProps` to your nested component. |
271
+
|`let:innerProps`|`Record<string, any>`| Provides a single combination of props at every iteration to the _default_ slot. Use this alongside `asChild` to spread `innerProps` to your nested component. |
275
272
|`let:label`|`string`| Generated label for a given instance. This is provided to the `label` slot. See [adding labels](#adding-labels-svelte-4) for more details. |
| *default* | `let:innerProps` | Default slot. Contents get passed to provided `Component`. When `asChild` is set to `true`, contents **MAY** contain provided `Component` and its respective slots; see [usage with slots](#usage-with-slots-svelte-4) for more details. |
282
-
| `label` | `let:label`, `let:innerProps` | Provide your own label, styles, and logic instead of the default provided label. |
276
+
### Usage with Playwright
283
277
284
-
### Examples (Svelte 4)
278
+
1. Create a page using `<Cartesian />`
279
+
2. Set up a test to take a screenshot of your page.
285
280
286
-
See more examples in [end to end tests](./e2e/svelte-4/src/routes/).
287
-
288
-
## Svelte 5 usage (experimental)
281
+
```js
282
+
test("default slot", async ({ page }) => {
283
+
awaitpage.goto("localhost:4173/")
284
+
awaitexpect(page).toHaveScreenshot()
285
+
})
286
+
```
289
287
290
-
>[!WARNING]
291
-
>This component is based on the release candidate of Svelte 5 and is considered
292
-
>unstable. Any breaking changes will not be properly indicated in
293
-
>`svelte-cartesian` releases at this time, but there are no planned changes.
288
+
See complete Playwright examples in [end to end
289
+
tests](./e2e/svelte-4/src/routes/).
294
290
295
-
1. Install package
291
+
### Usage with Storybook
296
292
297
-
```bash
298
-
npm install -D svelte-cartesian
299
-
```
293
+
1. Set up a component story.
294
+
2. Import `<Cartesian />` to render prop combinations:
0 commit comments