@synerise/ds-mocks 0.1.11 → 0.1.13

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Button/index.js +5 -1
  3. package/dist/Button/jest.d.ts +1 -1
  4. package/dist/Button/jest.js +25 -36
  5. package/dist/Button/vi.d.ts +3 -4
  6. package/dist/Button/vi.js +19 -50
  7. package/dist/Cruds/index.js +5 -1
  8. package/dist/Cruds/jest.d.ts +1 -1
  9. package/dist/Cruds/jest.js +33 -52
  10. package/dist/Cruds/vi.d.ts +3 -4
  11. package/dist/Cruds/vi.js +27 -66
  12. package/dist/Dropdown/index.js +5 -1
  13. package/dist/Dropdown/jest.d.ts +1 -1
  14. package/dist/Dropdown/jest.js +31 -38
  15. package/dist/Dropdown/vi.d.ts +3 -4
  16. package/dist/Dropdown/vi.js +25 -52
  17. package/dist/Form/index.js +5 -1
  18. package/dist/Form/jest.d.ts +2 -2
  19. package/dist/Form/jest.js +58 -75
  20. package/dist/Form/vi.d.ts +6 -16
  21. package/dist/Form/vi.js +56 -93
  22. package/dist/Icon/index.js +6 -1
  23. package/dist/Icon/jest.d.ts +1 -1
  24. package/dist/Icon/jest.js +34 -75
  25. package/dist/Icon/vi.d.ts +4 -5
  26. package/dist/Icon/vi.js +26 -69
  27. package/dist/Input/index.js +5 -1
  28. package/dist/Input/jest.d.ts +1 -1
  29. package/dist/Input/jest.js +35 -58
  30. package/dist/Input/vi.d.ts +5 -6
  31. package/dist/Input/vi.js +29 -72
  32. package/dist/Modal/index.js +5 -1
  33. package/dist/Modal/jest.d.ts +1 -1
  34. package/dist/Modal/jest.js +52 -66
  35. package/dist/Modal/vi.d.ts +3 -4
  36. package/dist/Modal/vi.js +46 -80
  37. package/dist/Scrollbar/index.js +4 -1
  38. package/dist/Scrollbar/vi.d.ts +1 -1
  39. package/dist/Scrollbar/vi.js +10 -22
  40. package/dist/Select/index.js +5 -1
  41. package/dist/Select/jest.d.ts +1 -1
  42. package/dist/Select/jest.js +48 -66
  43. package/dist/Select/vi.d.ts +5 -9
  44. package/dist/Select/vi.js +42 -80
  45. package/dist/Table/index.js +5 -1
  46. package/dist/Table/jest.d.ts +1 -1
  47. package/dist/Table/jest.js +85 -105
  48. package/dist/Table/vi.d.ts +3 -4
  49. package/dist/Table/vi.js +79 -120
  50. package/dist/Tabs/index.js +5 -1
  51. package/dist/Tabs/jest.d.ts +1 -1
  52. package/dist/Tabs/jest.js +29 -45
  53. package/dist/Tabs/vi.d.ts +3 -4
  54. package/dist/Tabs/vi.js +23 -59
  55. package/dist/Tooltip/index.js +5 -1
  56. package/dist/Tooltip/jest.d.ts +1 -1
  57. package/dist/Tooltip/jest.js +33 -39
  58. package/dist/Tooltip/vi.d.ts +3 -4
  59. package/dist/Tooltip/vi.js +27 -55
  60. package/dist/index.js +40 -14
  61. package/dist/jest.js +36 -11
  62. package/package.json +119 -119
package/dist/Form/jest.js CHANGED
@@ -1,95 +1,78 @@
1
- import React from 'react';
2
- export var mockForm = function mockForm() {
3
- jest.mock('@synerise/ds-form', function () {
4
- var FieldSet = jest.fn(function (_ref) {
5
- var heading = _ref.heading,
6
- description = _ref.description,
7
- children = _ref.children,
8
- withLine = _ref.withLine,
9
- dataTestId = _ref['data-testid'];
10
- var testId = dataTestId || 'ds-fieldset';
11
- return /*#__PURE__*/React.createElement("div", {
12
- "data-testid": testId,
13
- className: "ds-fieldset",
14
- "data-with-line": withLine
15
- }, heading && /*#__PURE__*/React.createElement("div", {
16
- "data-testid": testId + "-heading"
17
- }, heading), description && /*#__PURE__*/React.createElement("div", {
18
- "data-testid": testId + "-description"
19
- }, description), children);
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ const mockForm = () => {
3
+ jest.mock("@synerise/ds-form", () => {
4
+ const FieldSet = jest.fn(({
5
+ heading,
6
+ description,
7
+ children,
8
+ withLine,
9
+ "data-testid": dataTestId
10
+ }) => {
11
+ const testId = dataTestId || "ds-fieldset";
12
+ return /* @__PURE__ */ jsxs("div", { "data-testid": testId, className: "ds-fieldset", "data-with-line": withLine, children: [
13
+ heading && /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-heading`, children: heading }),
14
+ description && /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-description`, children: description }),
15
+ children
16
+ ] });
20
17
  });
21
- var Form = Object.assign(jest.fn(function () {
22
- return null;
23
- }), {
24
- FieldSet: FieldSet
18
+ const Form = Object.assign(jest.fn(() => null), {
19
+ FieldSet
25
20
  });
26
21
  return {
27
22
  __esModule: true,
28
- "default": Form,
29
- EditableList: jest.fn(function (_ref2) {
30
- var _ref2$value = _ref2.value,
31
- value = _ref2$value === void 0 ? [] : _ref2$value,
32
- onClickDelete = _ref2.onClickDelete,
33
- leftColumnName = _ref2.leftColumnName,
34
- rightColumnName = _ref2.rightColumnName,
35
- addButtonConfig = _ref2.addButtonConfig,
36
- renderLeftColumn = _ref2.renderLeftColumn,
37
- renderRightColumn = _ref2.renderRightColumn,
38
- renderActions = _ref2.renderActions,
39
- dataTestId = _ref2['data-testid'];
40
- var testId = dataTestId || 'ds-editable-list';
41
- var renderRowActions = function renderRowActions(param, index, params) {
42
- if (typeof renderActions === 'function') {
23
+ default: Form,
24
+ EditableList: jest.fn(({
25
+ value = [],
26
+ onClickDelete,
27
+ leftColumnName,
28
+ rightColumnName,
29
+ addButtonConfig,
30
+ renderLeftColumn,
31
+ renderRightColumn,
32
+ renderActions,
33
+ "data-testid": dataTestId
34
+ }) => {
35
+ const testId = dataTestId || "ds-editable-list";
36
+ const renderRowActions = (param, index, params) => {
37
+ if (typeof renderActions === "function") {
43
38
  return renderActions(param, index, params, {
44
- onClickDelete: onClickDelete
39
+ onClickDelete
45
40
  });
46
41
  }
47
42
  if (renderActions === false) {
48
43
  return null;
49
44
  }
50
- return /*#__PURE__*/React.createElement("button", {
51
- "data-testid": testId + "-delete-" + index,
52
- onClick: function onClick() {
53
- return onClickDelete == null ? void 0 : onClickDelete(param, index);
54
- }
55
- }, "Delete");
45
+ return /* @__PURE__ */ jsx("button", { "data-testid": `${testId}-delete-${index}`, onClick: () => onClickDelete?.(param, index), children: "Delete" });
56
46
  };
57
- return /*#__PURE__*/React.createElement("div", {
58
- "data-testid": testId,
59
- className: "ds-editable-list"
60
- }, /*#__PURE__*/React.createElement("div", {
61
- "data-testid": testId + "-header"
62
- }, leftColumnName && /*#__PURE__*/React.createElement("span", null, leftColumnName), rightColumnName && /*#__PURE__*/React.createElement("span", null, rightColumnName)), /*#__PURE__*/React.createElement("div", {
63
- "data-testid": testId + "-rows"
64
- }, value.map(function (param, index) {
65
- return /*#__PURE__*/React.createElement("div", {
66
- key: index,
67
- "data-testid": testId + "-row-" + index
68
- }, renderLeftColumn ? renderLeftColumn(param, index) : /*#__PURE__*/React.createElement("span", null, param.name), renderRightColumn ? renderRightColumn(param, index) : /*#__PURE__*/React.createElement("span", null, param.value), renderRowActions(param, index, value));
69
- })), addButtonConfig && /*#__PURE__*/React.createElement("button", {
70
- "data-testid": testId + "-add",
71
- onClick: addButtonConfig.onClickAddRow,
72
- disabled: addButtonConfig.disableAddButton
73
- }, addButtonConfig.textAddButton || 'Add'));
47
+ return /* @__PURE__ */ jsxs("div", { "data-testid": testId, className: "ds-editable-list", children: [
48
+ /* @__PURE__ */ jsxs("div", { "data-testid": `${testId}-header`, children: [
49
+ leftColumnName && /* @__PURE__ */ jsx("span", { children: leftColumnName }),
50
+ rightColumnName && /* @__PURE__ */ jsx("span", { children: rightColumnName })
51
+ ] }),
52
+ /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-rows`, children: value.map((param, index) => /* @__PURE__ */ jsxs("div", { "data-testid": `${testId}-row-${index}`, children: [
53
+ renderLeftColumn ? renderLeftColumn(param, index) : /* @__PURE__ */ jsx("span", { children: param.name }),
54
+ renderRightColumn ? renderRightColumn(param, index) : /* @__PURE__ */ jsx("span", { children: param.value }),
55
+ renderRowActions(param, index, value)
56
+ ] }, index)) }),
57
+ addButtonConfig && /* @__PURE__ */ jsx("button", { "data-testid": `${testId}-add`, onClick: addButtonConfig.onClickAddRow, disabled: addButtonConfig.disableAddButton, children: addButtonConfig.textAddButton || "Add" })
58
+ ] });
74
59
  })
75
60
  };
76
61
  });
77
62
  };
78
- export var mockFormMinimal = function mockFormMinimal() {
79
- jest.mock('@synerise/ds-form', function () {
80
- var Form = Object.assign(jest.fn(function () {
81
- return null;
82
- }), {
83
- FieldSet: jest.fn(function () {
84
- return null;
85
- })
63
+ const mockFormMinimal = () => {
64
+ jest.mock("@synerise/ds-form", () => {
65
+ const Form = Object.assign(jest.fn(() => null), {
66
+ FieldSet: jest.fn(() => null)
86
67
  });
87
68
  return {
88
69
  __esModule: true,
89
- "default": Form,
90
- EditableList: jest.fn(function () {
91
- return null;
92
- })
70
+ default: Form,
71
+ EditableList: jest.fn(() => null)
93
72
  };
94
73
  });
95
- };
74
+ };
75
+ export {
76
+ mockForm,
77
+ mockFormMinimal
78
+ };
package/dist/Form/vi.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import React, { type ReactNode } from 'react';
2
- import type { EditListProps, EditableParam } from '@synerise/ds-form';
1
+ import { ReactNode } from 'react';
2
+ import { EditListProps, EditableParam } from '@synerise/ds-form';
3
3
  export type { EditableParam };
4
4
  export type MockEditableListProps = EditListProps & {
5
5
  'data-testid'?: string;
@@ -24,13 +24,8 @@ export type MockFieldSetProps = {
24
24
  * ```
25
25
  */
26
26
  export declare const formMockFactory: () => {
27
- default: import("vitest").MockInstance<() => null> & {
28
- (): null;
29
- new (): null;
30
- } & {} & {
31
- FieldSet: import("vitest").Mock<({ heading, description, children, withLine, "data-testid": dataTestId, }: MockFieldSetProps) => React.JSX.Element>;
32
- };
33
- EditableList: import("vitest").Mock<({ value, onClickDelete, leftColumnName, rightColumnName, addButtonConfig, renderLeftColumn, renderRightColumn, renderActions, "data-testid": dataTestId, }: MockEditableListProps) => React.JSX.Element>;
27
+ default: any;
28
+ EditableList: any;
34
29
  };
35
30
  /**
36
31
  * Factory function for minimal Form mock.
@@ -41,11 +36,6 @@ export declare const formMockFactory: () => {
41
36
  * ```
42
37
  */
43
38
  export declare const formMinimalMockFactory: () => {
44
- default: import("vitest").MockInstance<() => null> & {
45
- (): null;
46
- new (): null;
47
- } & {} & {
48
- FieldSet: import("vitest").Mock<() => null>;
49
- };
50
- EditableList: import("vitest").Mock<() => null>;
39
+ default: any;
40
+ EditableList: any;
51
41
  };
package/dist/Form/vi.js CHANGED
@@ -1,109 +1,72 @@
1
- import React from 'react';
2
- /**
3
- * Factory function for Form mock.
4
- * Mocks the entire @synerise/ds-form package including Form, Form.FieldSet, and EditableList.
5
- *
6
- * @example
7
- * ```typescript
8
- * import { formMockFactory } from '@synerise/ds-mocks/Form/vi';
9
- *
10
- * vi.mock('@synerise/ds-form', formMockFactory);
11
- * ```
12
- */
13
- export var formMockFactory = function formMockFactory() {
14
- var FieldSet = vi.fn(function (_ref) {
15
- var heading = _ref.heading,
16
- description = _ref.description,
17
- children = _ref.children,
18
- withLine = _ref.withLine,
19
- dataTestId = _ref['data-testid'];
20
- var testId = dataTestId || 'ds-fieldset';
21
- return /*#__PURE__*/React.createElement("div", {
22
- "data-testid": testId,
23
- className: "ds-fieldset",
24
- "data-with-line": withLine
25
- }, heading && /*#__PURE__*/React.createElement("div", {
26
- "data-testid": testId + "-heading"
27
- }, heading), description && /*#__PURE__*/React.createElement("div", {
28
- "data-testid": testId + "-description"
29
- }, description), children);
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ const formMockFactory = () => {
3
+ const FieldSet = vi.fn(({
4
+ heading,
5
+ description,
6
+ children,
7
+ withLine,
8
+ "data-testid": dataTestId
9
+ }) => {
10
+ const testId = dataTestId || "ds-fieldset";
11
+ return /* @__PURE__ */ jsxs("div", { "data-testid": testId, className: "ds-fieldset", "data-with-line": withLine, children: [
12
+ heading && /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-heading`, children: heading }),
13
+ description && /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-description`, children: description }),
14
+ children
15
+ ] });
30
16
  });
31
- var Form = Object.assign(vi.fn(function () {
32
- return null;
33
- }), {
34
- FieldSet: FieldSet
17
+ const Form = Object.assign(vi.fn(() => null), {
18
+ FieldSet
35
19
  });
36
20
  return {
37
- "default": Form,
38
- EditableList: vi.fn(function (_ref2) {
39
- var _ref2$value = _ref2.value,
40
- value = _ref2$value === void 0 ? [] : _ref2$value,
41
- onClickDelete = _ref2.onClickDelete,
42
- leftColumnName = _ref2.leftColumnName,
43
- rightColumnName = _ref2.rightColumnName,
44
- addButtonConfig = _ref2.addButtonConfig,
45
- renderLeftColumn = _ref2.renderLeftColumn,
46
- renderRightColumn = _ref2.renderRightColumn,
47
- renderActions = _ref2.renderActions,
48
- dataTestId = _ref2['data-testid'];
49
- var testId = dataTestId || 'ds-editable-list';
50
- var renderRowActions = function renderRowActions(param, index, params) {
51
- if (typeof renderActions === 'function') {
21
+ default: Form,
22
+ EditableList: vi.fn(({
23
+ value = [],
24
+ onClickDelete,
25
+ leftColumnName,
26
+ rightColumnName,
27
+ addButtonConfig,
28
+ renderLeftColumn,
29
+ renderRightColumn,
30
+ renderActions,
31
+ "data-testid": dataTestId
32
+ }) => {
33
+ const testId = dataTestId || "ds-editable-list";
34
+ const renderRowActions = (param, index, params) => {
35
+ if (typeof renderActions === "function") {
52
36
  return renderActions(param, index, params, {
53
- onClickDelete: onClickDelete
37
+ onClickDelete
54
38
  });
55
39
  }
56
40
  if (renderActions === false) {
57
41
  return null;
58
42
  }
59
- return /*#__PURE__*/React.createElement("button", {
60
- "data-testid": testId + "-delete-" + index,
61
- onClick: function onClick() {
62
- return onClickDelete == null ? void 0 : onClickDelete(param, index);
63
- }
64
- }, "Delete");
43
+ return /* @__PURE__ */ jsx("button", { "data-testid": `${testId}-delete-${index}`, onClick: () => onClickDelete?.(param, index), children: "Delete" });
65
44
  };
66
- return /*#__PURE__*/React.createElement("div", {
67
- "data-testid": testId,
68
- className: "ds-editable-list"
69
- }, /*#__PURE__*/React.createElement("div", {
70
- "data-testid": testId + "-header"
71
- }, leftColumnName && /*#__PURE__*/React.createElement("span", null, leftColumnName), rightColumnName && /*#__PURE__*/React.createElement("span", null, rightColumnName)), /*#__PURE__*/React.createElement("div", {
72
- "data-testid": testId + "-rows"
73
- }, value.map(function (param, index) {
74
- return /*#__PURE__*/React.createElement("div", {
75
- key: index,
76
- "data-testid": testId + "-row-" + index
77
- }, renderLeftColumn ? renderLeftColumn(param, index) : /*#__PURE__*/React.createElement("span", null, param.name), renderRightColumn ? renderRightColumn(param, index) : /*#__PURE__*/React.createElement("span", null, param.value), renderRowActions(param, index, value));
78
- })), addButtonConfig && /*#__PURE__*/React.createElement("button", {
79
- "data-testid": testId + "-add",
80
- onClick: addButtonConfig.onClickAddRow,
81
- disabled: addButtonConfig.disableAddButton
82
- }, addButtonConfig.textAddButton || 'Add'));
45
+ return /* @__PURE__ */ jsxs("div", { "data-testid": testId, className: "ds-editable-list", children: [
46
+ /* @__PURE__ */ jsxs("div", { "data-testid": `${testId}-header`, children: [
47
+ leftColumnName && /* @__PURE__ */ jsx("span", { children: leftColumnName }),
48
+ rightColumnName && /* @__PURE__ */ jsx("span", { children: rightColumnName })
49
+ ] }),
50
+ /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-rows`, children: value.map((param, index) => /* @__PURE__ */ jsxs("div", { "data-testid": `${testId}-row-${index}`, children: [
51
+ renderLeftColumn ? renderLeftColumn(param, index) : /* @__PURE__ */ jsx("span", { children: param.name }),
52
+ renderRightColumn ? renderRightColumn(param, index) : /* @__PURE__ */ jsx("span", { children: param.value }),
53
+ renderRowActions(param, index, value)
54
+ ] }, index)) }),
55
+ addButtonConfig && /* @__PURE__ */ jsx("button", { "data-testid": `${testId}-add`, onClick: addButtonConfig.onClickAddRow, disabled: addButtonConfig.disableAddButton, children: addButtonConfig.textAddButton || "Add" })
56
+ ] });
83
57
  })
84
58
  };
85
59
  };
86
-
87
- /**
88
- * Factory function for minimal Form mock.
89
- *
90
- * @example
91
- * ```typescript
92
- * vi.mock('@synerise/ds-form', formMinimalMockFactory);
93
- * ```
94
- */
95
- export var formMinimalMockFactory = function formMinimalMockFactory() {
96
- var Form = Object.assign(vi.fn(function () {
97
- return null;
98
- }), {
99
- FieldSet: vi.fn(function () {
100
- return null;
101
- })
60
+ const formMinimalMockFactory = () => {
61
+ const Form = Object.assign(vi.fn(() => null), {
62
+ FieldSet: vi.fn(() => null)
102
63
  });
103
64
  return {
104
- "default": Form,
105
- EditableList: vi.fn(function () {
106
- return null;
107
- })
65
+ default: Form,
66
+ EditableList: vi.fn(() => null)
108
67
  };
109
- };
68
+ };
69
+ export {
70
+ formMinimalMockFactory,
71
+ formMockFactory
72
+ };
@@ -1 +1,6 @@
1
- export * from './vi';
1
+ import { iconMinimalMockFactory, iconMockFactory, iconWithRenderMockFactory } from "./vi.js";
2
+ export {
3
+ iconMinimalMockFactory,
4
+ iconMockFactory,
5
+ iconWithRenderMockFactory
6
+ };
@@ -1,4 +1,4 @@
1
- import type { IconProps } from '@synerise/ds-icon';
1
+ import { IconProps } from '@synerise/ds-icon';
2
2
  export type MockIconProps = IconProps & {
3
3
  'data-testid'?: string;
4
4
  /** Icon name as string */
package/dist/Icon/jest.js CHANGED
@@ -1,77 +1,36 @@
1
- import React from 'react';
2
- /**
3
- * Mocks the main Icon component from @synerise/ds-icon.
4
- * The mock renders the `iconName` prop as text content.
5
- *
6
- * @example
7
- * ```tsx
8
- * // In your test file:
9
- * import { mockIcon } from '@synerise/ds-mocks/Icon/jest';
10
- *
11
- * mockIcon();
12
- *
13
- * // Then in your component:
14
- * <Icon iconName="InfoM" /> // Renders as: <div data-icon="InfoM">InfoM</div>
15
- * ```
16
- */
17
- export var mockIcon = function mockIcon() {
18
- jest.mock('@synerise/ds-icon', function () {
19
- return {
20
- __esModule: true,
21
- "default": jest.fn(function (_ref) {
22
- var name = _ref.name,
23
- iconName = _ref.iconName,
24
- component = _ref.component,
25
- className = _ref.className,
26
- size = _ref.size,
27
- color = _ref.color,
28
- stroke = _ref.stroke,
29
- dataTestId = _ref['data-testid'];
30
- var resolvedIconName = iconName || name;
31
- return /*#__PURE__*/React.createElement("div", {
32
- className: "ds-icon " + (className || ''),
33
- "data-testid": dataTestId || 'ds-icon',
34
- "data-icon": resolvedIconName,
35
- "data-icon-size": size,
36
- "data-icon-color": color,
37
- "data-icon-stroke": stroke,
38
- title: resolvedIconName
39
- }, component || resolvedIconName || 'Icon');
40
- })
41
- };
42
- });
1
+ import { jsx } from "react/jsx-runtime";
2
+ const mockIcon = () => {
3
+ jest.mock("@synerise/ds-icon", () => ({
4
+ __esModule: true,
5
+ default: jest.fn(({
6
+ name,
7
+ iconName,
8
+ component,
9
+ className,
10
+ size,
11
+ color,
12
+ stroke,
13
+ "data-testid": dataTestId
14
+ }) => {
15
+ const resolvedIconName = iconName || name;
16
+ return /* @__PURE__ */ jsx("div", { className: `ds-icon ${className || ""}`, "data-testid": dataTestId || "ds-icon", "data-icon": resolvedIconName, "data-icon-size": size, "data-icon-color": color, "data-icon-stroke": stroke, title: resolvedIconName, children: component || resolvedIconName || "Icon" });
17
+ })
18
+ }));
43
19
  };
44
-
45
- /**
46
- * Mocks the Icon component with a custom render function.
47
- *
48
- * @example
49
- * ```tsx
50
- * mockIconWithRender((props) => (
51
- * <span data-custom-icon={props.iconName}>{props.iconName}</span>
52
- * ));
53
- * ```
54
- */
55
- export var mockIconWithRender = function mockIconWithRender(renderFn) {
56
- jest.mock('@synerise/ds-icon', function () {
57
- return {
58
- __esModule: true,
59
- "default": jest.fn(renderFn)
60
- };
61
- });
20
+ const mockIconWithRender = (renderFn) => {
21
+ jest.mock("@synerise/ds-icon", () => ({
22
+ __esModule: true,
23
+ default: jest.fn(renderFn)
24
+ }));
25
+ };
26
+ const mockIconMinimal = () => {
27
+ jest.mock("@synerise/ds-icon", () => ({
28
+ __esModule: true,
29
+ default: jest.fn(() => null)
30
+ }));
31
+ };
32
+ export {
33
+ mockIcon,
34
+ mockIconMinimal,
35
+ mockIconWithRender
62
36
  };
63
-
64
- /**
65
- * Mocks the Icon component to render nothing (null).
66
- * Useful when you don't need to test icon rendering.
67
- */
68
- export var mockIconMinimal = function mockIconMinimal() {
69
- jest.mock('@synerise/ds-icon', function () {
70
- return {
71
- __esModule: true,
72
- "default": jest.fn(function () {
73
- return null;
74
- })
75
- };
76
- });
77
- };
package/dist/Icon/vi.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import type { IconProps } from '@synerise/ds-icon';
1
+ import { IconProps } from '@synerise/ds-icon';
3
2
  export type MockIconProps = IconProps & {
4
3
  'data-testid'?: string;
5
4
  /** Icon name as string */
@@ -17,7 +16,7 @@ export type MockIconProps = IconProps & {
17
16
  * ```
18
17
  */
19
18
  export declare const iconMockFactory: () => {
20
- default: import("vitest").Mock<({ name, iconName, component, className, size, color, stroke, "data-testid": dataTestId, }: MockIconProps) => React.JSX.Element>;
19
+ default: any;
21
20
  };
22
21
  /**
23
22
  * Factory function for Icon mock with custom render function.
@@ -30,7 +29,7 @@ export declare const iconMockFactory: () => {
30
29
  * ```
31
30
  */
32
31
  export declare const iconWithRenderMockFactory: (renderFn: (props: IconProps) => JSX.Element) => () => {
33
- default: import("vitest").Mock<(props: IconProps) => JSX.Element>;
32
+ default: any;
34
33
  };
35
34
  /**
36
35
  * Factory function for minimal Icon mock.
@@ -41,5 +40,5 @@ export declare const iconWithRenderMockFactory: (renderFn: (props: IconProps) =>
41
40
  * ```
42
41
  */
43
42
  export declare const iconMinimalMockFactory: () => {
44
- default: import("vitest").Mock<() => null>;
43
+ default: any;
45
44
  };
package/dist/Icon/vi.js CHANGED
@@ -1,70 +1,27 @@
1
- import React from 'react';
2
- /**
3
- * Factory function for Icon mock.
4
- * Use directly with vi.mock() to avoid hoisting issues.
5
- *
6
- * @example
7
- * ```typescript
8
- * import { iconMockFactory } from '@synerise/ds-mocks/Icon/vi';
9
- *
10
- * vi.mock('@synerise/ds-icon', iconMockFactory);
11
- * ```
12
- */
13
- export var iconMockFactory = function iconMockFactory() {
14
- return {
15
- "default": vi.fn(function (_ref) {
16
- var name = _ref.name,
17
- iconName = _ref.iconName,
18
- component = _ref.component,
19
- className = _ref.className,
20
- size = _ref.size,
21
- color = _ref.color,
22
- stroke = _ref.stroke,
23
- dataTestId = _ref['data-testid'];
24
- var resolvedIconName = iconName || name;
25
- return /*#__PURE__*/React.createElement("div", {
26
- className: "ds-icon " + (className || ''),
27
- "data-testid": dataTestId || 'ds-icon',
28
- "data-icon": resolvedIconName,
29
- "data-icon-size": size,
30
- "data-icon-color": color,
31
- "data-icon-stroke": stroke,
32
- title: resolvedIconName
33
- }, component || resolvedIconName || 'Icon');
34
- })
35
- };
1
+ import { jsx } from "react/jsx-runtime";
2
+ const iconMockFactory = () => ({
3
+ default: vi.fn(({
4
+ name,
5
+ iconName,
6
+ component,
7
+ className,
8
+ size,
9
+ color,
10
+ stroke,
11
+ "data-testid": dataTestId
12
+ }) => {
13
+ const resolvedIconName = iconName || name;
14
+ return /* @__PURE__ */ jsx("div", { className: `ds-icon ${className || ""}`, "data-testid": dataTestId || "ds-icon", "data-icon": resolvedIconName, "data-icon-size": size, "data-icon-color": color, "data-icon-stroke": stroke, title: resolvedIconName, children: component || resolvedIconName || "Icon" });
15
+ })
16
+ });
17
+ const iconWithRenderMockFactory = (renderFn) => () => ({
18
+ default: vi.fn(renderFn)
19
+ });
20
+ const iconMinimalMockFactory = () => ({
21
+ default: vi.fn(() => null)
22
+ });
23
+ export {
24
+ iconMinimalMockFactory,
25
+ iconMockFactory,
26
+ iconWithRenderMockFactory
36
27
  };
37
-
38
- /**
39
- * Factory function for Icon mock with custom render function.
40
- *
41
- * @example
42
- * ```typescript
43
- * vi.mock('@synerise/ds-icon', iconWithRenderMockFactory((props) => (
44
- * <span data-custom-icon={props.iconName}>{props.iconName}</span>
45
- * )));
46
- * ```
47
- */
48
- export var iconWithRenderMockFactory = function iconWithRenderMockFactory(renderFn) {
49
- return function () {
50
- return {
51
- "default": vi.fn(renderFn)
52
- };
53
- };
54
- };
55
-
56
- /**
57
- * Factory function for minimal Icon mock.
58
- *
59
- * @example
60
- * ```typescript
61
- * vi.mock('@synerise/ds-icon', iconMinimalMockFactory);
62
- * ```
63
- */
64
- export var iconMinimalMockFactory = function iconMinimalMockFactory() {
65
- return {
66
- "default": vi.fn(function () {
67
- return null;
68
- })
69
- };
70
- };
@@ -1 +1,5 @@
1
- export * from './vi';
1
+ import { inputMinimalMockFactory, inputMockFactory } from "./vi.js";
2
+ export {
3
+ inputMinimalMockFactory,
4
+ inputMockFactory
5
+ };
@@ -1,4 +1,4 @@
1
- import type { InputProps } from '@synerise/ds-input';
1
+ import { InputProps } from '@synerise/ds-input';
2
2
  export type MockInputProps = InputProps & {
3
3
  'data-testid'?: string;
4
4
  };