reshaped 3.7.0-canary.17 → 3.7.0-canary.19
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.
- package/CHANGELOG.md +7 -1
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +8 -8
- package/dist/components/ActionBar/ActionBar.js +11 -4
- package/dist/components/ActionBar/ActionBar.module.css +1 -1
- package/dist/components/ActionBar/ActionBar.types.d.ts +5 -1
- package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +23 -1
- package/dist/components/ActionBar/tests/ActionBar.stories.js +175 -3
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/FileUpload/FileUpload.js +5 -3
- package/dist/components/FileUpload/FileUpload.module.css +1 -1
- package/dist/components/FileUpload/FileUpload.types.d.ts +5 -1
- package/dist/components/FileUpload/tests/FileUpload.stories.d.ts +18 -2
- package/dist/components/FileUpload/tests/FileUpload.stories.js +102 -23
- package/dist/components/Popover/tests/Popover.stories.js +4 -3
- package/package.json +1 -1
- package/dist/components/ActionBar/tests/ActionBar.test.stories.d.ts +0 -15
- package/dist/components/ActionBar/tests/ActionBar.test.stories.js +0 -26
- package/dist/components/FileUpload/tests/FileUpload.test.stories.d.ts +0 -21
- package/dist/components/FileUpload/tests/FileUpload.test.stories.js +0 -52
@@ -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
|
-
};
|