@sit-onyx/storybook-utils 1.0.0-beta.41 → 1.0.0-beta.43
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/package.json +5 -2
- package/src/actions.spec.ts +29 -0
- package/src/actions.ts +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/storybook-utils",
|
|
3
3
|
"description": "Storybook utilities for Vue",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.43",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Schwarz IT KG",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -27,11 +27,14 @@
|
|
|
27
27
|
"storybook": ">= 8.2.0",
|
|
28
28
|
"storybook-dark-mode": ">= 4",
|
|
29
29
|
"@sit-onyx/icons": "^1.0.0-beta.1",
|
|
30
|
-
"sit-onyx": "^1.0.0-beta.
|
|
30
|
+
"sit-onyx": "^1.0.0-beta.40"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"deepmerge-ts": "^7.1.0"
|
|
34
34
|
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"vue": "~3.4.0"
|
|
37
|
+
},
|
|
35
38
|
"scripts": {
|
|
36
39
|
"build": "tsc --noEmit",
|
|
37
40
|
"test": "vitest",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StoryContextForEnhancers } from "storybook/internal/types";
|
|
2
|
+
import { expect, test } from "vitest";
|
|
3
|
+
import { enhanceEventArgTypes } from "./actions";
|
|
4
|
+
|
|
5
|
+
test("should enhance event arg types", () => {
|
|
6
|
+
const argTypes = {
|
|
7
|
+
someProp: {
|
|
8
|
+
name: "someProp",
|
|
9
|
+
table: { category: "props" },
|
|
10
|
+
},
|
|
11
|
+
click: {
|
|
12
|
+
name: "click",
|
|
13
|
+
table: { category: "events" },
|
|
14
|
+
},
|
|
15
|
+
} satisfies StoryContextForEnhancers["argTypes"];
|
|
16
|
+
|
|
17
|
+
const result = enhanceEventArgTypes({
|
|
18
|
+
argTypes,
|
|
19
|
+
} as unknown as StoryContextForEnhancers);
|
|
20
|
+
|
|
21
|
+
expect(result).toStrictEqual({
|
|
22
|
+
...argTypes,
|
|
23
|
+
onClick: {
|
|
24
|
+
name: "onClick",
|
|
25
|
+
table: { disable: true },
|
|
26
|
+
action: "click",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
});
|
package/src/actions.ts
CHANGED
|
@@ -16,8 +16,8 @@ export const enhanceEventArgTypes: ArgTypesEnhancer = ({ argTypes }) => {
|
|
|
16
16
|
}
|
|
17
17
|
argTypes[eventName] = {
|
|
18
18
|
name: eventName,
|
|
19
|
-
table: { disable: true },
|
|
20
|
-
action:
|
|
19
|
+
table: { disable: true }, // do not add a second table entry for event name prefixed with "on"
|
|
20
|
+
action: name,
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
23
|
return argTypes;
|