reshaped 3.7.0-canary.17 → 3.7.0-canary.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- import { fn } from "storybook/test";
3
- declare const _default: {
4
- title: string;
5
- component: import("react").FC<import("./..").FileUploadProps> & {
6
- Trigger: import("react").FC<import("../FileUpload.types").TriggerProps>;
7
- };
8
- parameters: {
9
- iframe: {
10
- url: string;
11
- };
12
- chromatic: {
13
- disableSnapshot: boolean;
14
- };
15
- };
16
- };
17
- export default _default;
18
- export declare const onChange: StoryObj<{
19
- handleChange: ReturnType<typeof fn>;
20
- }>;
21
- export declare const className: StoryObj;
@@ -1,52 +0,0 @@
1
- import { expect, userEvent, fn } from "storybook/test";
2
- import FileUpload from "../index.js";
3
- export default {
4
- title: "Components/FileUpload/tests",
5
- component: FileUpload,
6
- parameters: {
7
- iframe: {
8
- url: "https://reshaped.so/docs/components/file-upload",
9
- },
10
- chromatic: { disableSnapshot: true },
11
- },
12
- };
13
- export const onChange = {
14
- name: "name, onChange",
15
- args: {
16
- handleChange: fn(),
17
- },
18
- render: (args) => (<div data-testid="root">
19
- <FileUpload name="test-name" onChange={args.handleChange}>
20
- Content
21
- </FileUpload>
22
- </div>),
23
- play: async ({ canvas, args }) => {
24
- const file = new File(["hello"], "hello.png", { type: "image/png" });
25
- const input = canvas.getByTestId("root").querySelector("input");
26
- await userEvent.upload(input, file);
27
- expect(input).toHaveAttribute("name", "test-name");
28
- expect(input.files?.[0]).toBe(file);
29
- expect(input.files).toHaveLength(1);
30
- expect(args.handleChange).toHaveBeenCalledTimes(1);
31
- expect(args.handleChange).toHaveBeenCalledWith({
32
- name: "test-name",
33
- value: [file],
34
- event: expect.objectContaining({ target: input }),
35
- });
36
- },
37
- };
38
- export const className = {
39
- name: "className, attributes",
40
- render: () => (<div data-testid="root">
41
- <FileUpload name="name" className="test-classname" attributes={{ id: "test-id" }} inputAttributes={{ id: "test-input-id" }}>
42
- Content
43
- </FileUpload>
44
- </div>),
45
- play: async ({ canvas }) => {
46
- const root = canvas.getByTestId("root").firstChild;
47
- const input = canvas.getByTestId("root").querySelector("input");
48
- expect(root).toHaveClass("test-classname");
49
- expect(root).toHaveAttribute("id", "test-id");
50
- expect(input).toHaveAttribute("id", "test-input-id");
51
- },
52
- };