@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.
- package/CHANGELOG.md +8 -0
- package/dist/Button/index.js +5 -1
- package/dist/Button/jest.d.ts +1 -1
- package/dist/Button/jest.js +25 -36
- package/dist/Button/vi.d.ts +3 -4
- package/dist/Button/vi.js +19 -50
- package/dist/Cruds/index.js +5 -1
- package/dist/Cruds/jest.d.ts +1 -1
- package/dist/Cruds/jest.js +33 -52
- package/dist/Cruds/vi.d.ts +3 -4
- package/dist/Cruds/vi.js +27 -66
- package/dist/Dropdown/index.js +5 -1
- package/dist/Dropdown/jest.d.ts +1 -1
- package/dist/Dropdown/jest.js +31 -38
- package/dist/Dropdown/vi.d.ts +3 -4
- package/dist/Dropdown/vi.js +25 -52
- package/dist/Form/index.js +5 -1
- package/dist/Form/jest.d.ts +2 -2
- package/dist/Form/jest.js +58 -75
- package/dist/Form/vi.d.ts +6 -16
- package/dist/Form/vi.js +56 -93
- package/dist/Icon/index.js +6 -1
- package/dist/Icon/jest.d.ts +1 -1
- package/dist/Icon/jest.js +34 -75
- package/dist/Icon/vi.d.ts +4 -5
- package/dist/Icon/vi.js +26 -69
- package/dist/Input/index.js +5 -1
- package/dist/Input/jest.d.ts +1 -1
- package/dist/Input/jest.js +35 -58
- package/dist/Input/vi.d.ts +5 -6
- package/dist/Input/vi.js +29 -72
- package/dist/Modal/index.js +5 -1
- package/dist/Modal/jest.d.ts +1 -1
- package/dist/Modal/jest.js +52 -66
- package/dist/Modal/vi.d.ts +3 -4
- package/dist/Modal/vi.js +46 -80
- package/dist/Scrollbar/index.js +4 -1
- package/dist/Scrollbar/vi.d.ts +1 -1
- package/dist/Scrollbar/vi.js +10 -22
- package/dist/Select/index.js +5 -1
- package/dist/Select/jest.d.ts +1 -1
- package/dist/Select/jest.js +48 -66
- package/dist/Select/vi.d.ts +5 -9
- package/dist/Select/vi.js +42 -80
- package/dist/Table/index.js +5 -1
- package/dist/Table/jest.d.ts +1 -1
- package/dist/Table/jest.js +85 -105
- package/dist/Table/vi.d.ts +3 -4
- package/dist/Table/vi.js +79 -120
- package/dist/Tabs/index.js +5 -1
- package/dist/Tabs/jest.d.ts +1 -1
- package/dist/Tabs/jest.js +29 -45
- package/dist/Tabs/vi.d.ts +3 -4
- package/dist/Tabs/vi.js +23 -59
- package/dist/Tooltip/index.js +5 -1
- package/dist/Tooltip/jest.d.ts +1 -1
- package/dist/Tooltip/jest.js +33 -39
- package/dist/Tooltip/vi.d.ts +3 -4
- package/dist/Tooltip/vi.js +27 -55
- package/dist/index.js +40 -14
- package/dist/jest.js +36 -11
- package/package.json +119 -119
package/dist/Table/vi.js
CHANGED
|
@@ -1,126 +1,85 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const getDataIndex = (dataIndex) => {
|
|
3
3
|
if (Array.isArray(dataIndex)) {
|
|
4
|
-
return dataIndex.join(
|
|
4
|
+
return dataIndex.join(".");
|
|
5
5
|
}
|
|
6
|
-
return String(dataIndex
|
|
6
|
+
return String(dataIndex ?? "");
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
return t;
|
|
47
|
-
};
|
|
48
|
-
var renderColumnTitle = function renderColumnTitle(colTitle) {
|
|
49
|
-
if (typeof colTitle === 'function') {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
return colTitle;
|
|
53
|
-
};
|
|
54
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
"data-testid": testId,
|
|
56
|
-
className: "ds-table",
|
|
57
|
-
"data-loading": loading
|
|
58
|
-
}, title && /*#__PURE__*/React.createElement("div", {
|
|
59
|
-
"data-testid": testId + "-title"
|
|
60
|
-
}, renderTitle(title)), loading ? /*#__PURE__*/React.createElement("div", {
|
|
61
|
-
"data-testid": testId + "-loading"
|
|
62
|
-
}, "Loading...") : /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", {
|
|
63
|
-
"data-testid": testId + "-header"
|
|
64
|
-
}, rowSelection && /*#__PURE__*/React.createElement("th", null, "Select"), columns.map(
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
|
-
function (col, idx) {
|
|
67
|
-
return /*#__PURE__*/React.createElement("th", {
|
|
68
|
-
key: col.key || idx,
|
|
69
|
-
"data-testid": testId + "-header-" + (getDataIndex(col.dataIndex) || idx)
|
|
70
|
-
}, renderColumnTitle(col.title));
|
|
71
|
-
}))), /*#__PURE__*/React.createElement("tbody", null, dataSource.map(
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
-
function (record, rowIndex) {
|
|
74
|
-
var _rowSelection$selecte;
|
|
75
|
-
var key = getRowKey(record, rowIndex);
|
|
76
|
-
var rowProps = onRow == null ? void 0 : onRow(record, rowIndex);
|
|
77
|
-
return /*#__PURE__*/React.createElement("tr", {
|
|
78
|
-
key: key,
|
|
79
|
-
"data-testid": testId + "-row-" + rowIndex,
|
|
80
|
-
onClick: rowProps == null ? void 0 : rowProps.onClick
|
|
81
|
-
}, rowSelection && /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("input", {
|
|
82
|
-
type: "checkbox",
|
|
83
|
-
"data-testid": testId + "-checkbox-" + rowIndex,
|
|
84
|
-
checked: (_rowSelection$selecte = rowSelection.selectedRowKeys) == null ? void 0 : _rowSelection$selecte.includes(key),
|
|
85
|
-
onChange: function onChange() {
|
|
86
|
-
var _rowSelection$selecte2;
|
|
87
|
-
var newKeys = (_rowSelection$selecte2 = rowSelection.selectedRowKeys) != null && _rowSelection$selecte2.includes(key) ? rowSelection.selectedRowKeys.filter(
|
|
8
|
+
const tableMockFactory = () => ({
|
|
9
|
+
default: vi.fn(({
|
|
10
|
+
dataSource = [],
|
|
11
|
+
columns = [],
|
|
12
|
+
loading,
|
|
13
|
+
rowKey = "key",
|
|
14
|
+
onRow,
|
|
15
|
+
rowSelection,
|
|
16
|
+
title,
|
|
17
|
+
"data-testid": dataTestId
|
|
18
|
+
}) => {
|
|
19
|
+
const testId = dataTestId || "ds-table";
|
|
20
|
+
const getRowKey = (record, index) => {
|
|
21
|
+
if (typeof rowKey === "function") {
|
|
22
|
+
return rowKey(record);
|
|
23
|
+
}
|
|
24
|
+
return String(record[rowKey] ?? index);
|
|
25
|
+
};
|
|
26
|
+
const renderTitle = (t) => {
|
|
27
|
+
if (typeof t === "function") {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
};
|
|
32
|
+
const renderColumnTitle = (colTitle) => {
|
|
33
|
+
if (typeof colTitle === "function") {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return colTitle;
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", { "data-testid": testId, className: "ds-table", "data-loading": loading, children: [
|
|
39
|
+
title && /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-title`, children: renderTitle(title) }),
|
|
40
|
+
loading ? /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-loading`, children: "Loading..." }) : /* @__PURE__ */ jsxs("table", { children: [
|
|
41
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { "data-testid": `${testId}-header`, children: [
|
|
42
|
+
rowSelection && /* @__PURE__ */ jsx("th", { children: "Select" }),
|
|
43
|
+
columns.map(
|
|
88
44
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
45
|
+
(col, idx) => /* @__PURE__ */ jsx("th", { "data-testid": `${testId}-header-${getDataIndex(col.dataIndex) || idx}`, children: renderColumnTitle(col.title) }, col.key || idx)
|
|
46
|
+
)
|
|
47
|
+
] }) }),
|
|
48
|
+
/* @__PURE__ */ jsx("tbody", { children: dataSource.map(
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
(record, rowIndex) => {
|
|
51
|
+
const key = getRowKey(record, rowIndex);
|
|
52
|
+
const rowProps = onRow?.(record, rowIndex);
|
|
53
|
+
return /* @__PURE__ */ jsxs("tr", { "data-testid": `${testId}-row-${rowIndex}`, onClick: rowProps?.onClick, children: [
|
|
54
|
+
rowSelection && /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("input", { type: "checkbox", "data-testid": `${testId}-checkbox-${rowIndex}`, checked: rowSelection.selectedRowKeys?.includes(key), onChange: () => {
|
|
55
|
+
const newKeys = rowSelection.selectedRowKeys?.includes(key) ? rowSelection.selectedRowKeys.filter(
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
(k) => k !== key
|
|
58
|
+
) : [...rowSelection.selectedRowKeys || [], key];
|
|
59
|
+
rowSelection.onChange?.(newKeys, [], {
|
|
60
|
+
type: "all"
|
|
61
|
+
});
|
|
62
|
+
} }) }),
|
|
63
|
+
columns.map(
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
+
(col, colIndex) => {
|
|
66
|
+
const dataIdx = getDataIndex(col.dataIndex);
|
|
67
|
+
const cellValue = record[dataIdx];
|
|
68
|
+
const rendered = col.render ? col.render(cellValue, record, rowIndex) : cellValue;
|
|
69
|
+
return /* @__PURE__ */ jsx("td", { "data-testid": `${testId}-cell-${rowIndex}-${colIndex}`, children: String(rendered ?? "") }, col.key || colIndex);
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] }, key);
|
|
95
73
|
}
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}))));
|
|
108
|
-
})
|
|
109
|
-
};
|
|
74
|
+
) })
|
|
75
|
+
] })
|
|
76
|
+
] });
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
const tableMinimalMockFactory = () => ({
|
|
80
|
+
default: vi.fn(() => null)
|
|
81
|
+
});
|
|
82
|
+
export {
|
|
83
|
+
tableMinimalMockFactory,
|
|
84
|
+
tableMockFactory
|
|
110
85
|
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Factory function for minimal Table mock.
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```typescript
|
|
117
|
-
* vi.mock('@synerise/ds-table', tableMinimalMockFactory);
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
export var tableMinimalMockFactory = function tableMinimalMockFactory() {
|
|
121
|
-
return {
|
|
122
|
-
"default": vi.fn(function () {
|
|
123
|
-
return null;
|
|
124
|
-
})
|
|
125
|
-
};
|
|
126
|
-
};
|
package/dist/Tabs/index.js
CHANGED
package/dist/Tabs/jest.d.ts
CHANGED
package/dist/Tabs/jest.js
CHANGED
|
@@ -1,46 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
jest.mock(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
className: activeTab === index ? 'active' : ''
|
|
31
|
-
}, tab.icon, tab.label);
|
|
32
|
-
}));
|
|
33
|
-
})
|
|
34
|
-
};
|
|
35
|
-
});
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
const mockTabs = () => {
|
|
3
|
+
jest.mock("@synerise/ds-tabs", () => ({
|
|
4
|
+
__esModule: true,
|
|
5
|
+
default: jest.fn(({
|
|
6
|
+
activeTab = 0,
|
|
7
|
+
tabs = [],
|
|
8
|
+
handleTabClick,
|
|
9
|
+
underscore,
|
|
10
|
+
block,
|
|
11
|
+
"data-testid": dataTestId
|
|
12
|
+
}) => {
|
|
13
|
+
const testId = dataTestId || "ds-tabs";
|
|
14
|
+
return /* @__PURE__ */ jsx("div", { "data-testid": testId, className: "ds-tabs", "data-underscore": underscore, "data-block": block, children: tabs.map((tab, index) => /* @__PURE__ */ jsxs("button", { "data-testid": `${testId}-tab-${index}`, "data-active": activeTab === index, disabled: tab.disabled, onClick: () => handleTabClick?.(index), className: activeTab === index ? "active" : "", children: [
|
|
15
|
+
tab.icon,
|
|
16
|
+
tab.label
|
|
17
|
+
] }, index)) });
|
|
18
|
+
})
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
const mockTabsMinimal = () => {
|
|
22
|
+
jest.mock("@synerise/ds-tabs", () => ({
|
|
23
|
+
__esModule: true,
|
|
24
|
+
default: jest.fn(() => null)
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
mockTabs,
|
|
29
|
+
mockTabsMinimal
|
|
36
30
|
};
|
|
37
|
-
export var mockTabsMinimal = function mockTabsMinimal() {
|
|
38
|
-
jest.mock('@synerise/ds-tabs', function () {
|
|
39
|
-
return {
|
|
40
|
-
__esModule: true,
|
|
41
|
-
"default": jest.fn(function () {
|
|
42
|
-
return null;
|
|
43
|
-
})
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
};
|
package/dist/Tabs/vi.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { TabItem, TabsProps } from '@synerise/ds-tabs';
|
|
1
|
+
import { TabItem, TabsProps } from '@synerise/ds-tabs';
|
|
3
2
|
export type { TabItem };
|
|
4
3
|
export type MockTabsProps = TabsProps & {
|
|
5
4
|
'data-testid'?: string;
|
|
@@ -16,7 +15,7 @@ export type MockTabsProps = TabsProps & {
|
|
|
16
15
|
* ```
|
|
17
16
|
*/
|
|
18
17
|
export declare const tabsMockFactory: () => {
|
|
19
|
-
default:
|
|
18
|
+
default: any;
|
|
20
19
|
};
|
|
21
20
|
/**
|
|
22
21
|
* Factory function for minimal Tabs mock.
|
|
@@ -27,5 +26,5 @@ export declare const tabsMockFactory: () => {
|
|
|
27
26
|
* ```
|
|
28
27
|
*/
|
|
29
28
|
export declare const tabsMinimalMockFactory: () => {
|
|
30
|
-
default:
|
|
29
|
+
default: any;
|
|
31
30
|
};
|
package/dist/Tabs/vi.js
CHANGED
|
@@ -1,60 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var testId = dataTestId || 'ds-tabs';
|
|
25
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
"data-testid": testId,
|
|
27
|
-
className: "ds-tabs",
|
|
28
|
-
"data-underscore": underscore,
|
|
29
|
-
"data-block": block
|
|
30
|
-
}, tabs.map(function (tab, index) {
|
|
31
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
32
|
-
key: index,
|
|
33
|
-
"data-testid": testId + "-tab-" + index,
|
|
34
|
-
"data-active": activeTab === index,
|
|
35
|
-
disabled: tab.disabled,
|
|
36
|
-
onClick: function onClick() {
|
|
37
|
-
return handleTabClick == null ? void 0 : handleTabClick(index);
|
|
38
|
-
},
|
|
39
|
-
className: activeTab === index ? 'active' : ''
|
|
40
|
-
}, tab.icon, tab.label);
|
|
41
|
-
}));
|
|
42
|
-
})
|
|
43
|
-
};
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
const tabsMockFactory = () => ({
|
|
3
|
+
default: vi.fn(({
|
|
4
|
+
activeTab = 0,
|
|
5
|
+
tabs = [],
|
|
6
|
+
handleTabClick,
|
|
7
|
+
underscore,
|
|
8
|
+
block,
|
|
9
|
+
"data-testid": dataTestId
|
|
10
|
+
}) => {
|
|
11
|
+
const testId = dataTestId || "ds-tabs";
|
|
12
|
+
return /* @__PURE__ */ jsx("div", { "data-testid": testId, className: "ds-tabs", "data-underscore": underscore, "data-block": block, children: tabs.map((tab, index) => /* @__PURE__ */ jsxs("button", { "data-testid": `${testId}-tab-${index}`, "data-active": activeTab === index, disabled: tab.disabled, onClick: () => handleTabClick?.(index), className: activeTab === index ? "active" : "", children: [
|
|
13
|
+
tab.icon,
|
|
14
|
+
tab.label
|
|
15
|
+
] }, index)) });
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
const tabsMinimalMockFactory = () => ({
|
|
19
|
+
default: vi.fn(() => null)
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
tabsMinimalMockFactory,
|
|
23
|
+
tabsMockFactory
|
|
44
24
|
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Factory function for minimal Tabs mock.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```typescript
|
|
51
|
-
* vi.mock('@synerise/ds-tabs', tabsMinimalMockFactory);
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
export var tabsMinimalMockFactory = function tabsMinimalMockFactory() {
|
|
55
|
-
return {
|
|
56
|
-
"default": vi.fn(function () {
|
|
57
|
-
return null;
|
|
58
|
-
})
|
|
59
|
-
};
|
|
60
|
-
};
|
package/dist/Tooltip/index.js
CHANGED
package/dist/Tooltip/jest.d.ts
CHANGED
package/dist/Tooltip/jest.js
CHANGED
|
@@ -1,40 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"data-testid": testId
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
const mockTooltip = (options = {}) => {
|
|
3
|
+
jest.mock("@synerise/ds-tooltip", () => ({
|
|
4
|
+
__esModule: true,
|
|
5
|
+
default: jest.fn(({
|
|
6
|
+
children,
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
type,
|
|
10
|
+
"data-testid": dataTestId
|
|
11
|
+
}) => {
|
|
12
|
+
const testId = dataTestId || "ds-tooltip";
|
|
13
|
+
return /* @__PURE__ */ jsxs("span", { "data-testid": testId, "data-tooltip-type": type, children: [
|
|
14
|
+
children,
|
|
15
|
+
options.showContent && (title || description) && /* @__PURE__ */ jsxs("div", { "data-testid": `${testId}-content`, children: [
|
|
16
|
+
title && /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-title`, children: title }),
|
|
17
|
+
description && /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-description`, children: description })
|
|
18
|
+
] })
|
|
19
|
+
] });
|
|
20
|
+
})
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
const mockTooltipMinimal = () => {
|
|
24
|
+
jest.mock("@synerise/ds-tooltip", () => ({
|
|
25
|
+
__esModule: true,
|
|
26
|
+
default: jest.fn(({
|
|
27
|
+
children
|
|
28
|
+
}) => /* @__PURE__ */ jsx(Fragment, { children }))
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
mockTooltip,
|
|
33
|
+
mockTooltipMinimal
|
|
29
34
|
};
|
|
30
|
-
export var mockTooltipMinimal = function mockTooltipMinimal() {
|
|
31
|
-
jest.mock('@synerise/ds-tooltip', function () {
|
|
32
|
-
return {
|
|
33
|
-
__esModule: true,
|
|
34
|
-
"default": jest.fn(function (_ref2) {
|
|
35
|
-
var children = _ref2.children;
|
|
36
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
};
|
package/dist/Tooltip/vi.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { TooltipProps } from '@synerise/ds-tooltip';
|
|
1
|
+
import { TooltipProps } from '@synerise/ds-tooltip';
|
|
3
2
|
export type MockTooltipProps = TooltipProps & {
|
|
4
3
|
'data-testid'?: string;
|
|
5
4
|
};
|
|
@@ -17,7 +16,7 @@ export type MockTooltipProps = TooltipProps & {
|
|
|
17
16
|
export declare const tooltipMockFactory: (options?: {
|
|
18
17
|
showContent?: boolean;
|
|
19
18
|
}) => () => {
|
|
20
|
-
default:
|
|
19
|
+
default: any;
|
|
21
20
|
};
|
|
22
21
|
/**
|
|
23
22
|
* Factory function for minimal Tooltip mock.
|
|
@@ -28,5 +27,5 @@ export declare const tooltipMockFactory: (options?: {
|
|
|
28
27
|
* ```
|
|
29
28
|
*/
|
|
30
29
|
export declare const tooltipMinimalMockFactory: () => {
|
|
31
|
-
default:
|
|
30
|
+
default: any;
|
|
32
31
|
};
|
package/dist/Tooltip/vi.js
CHANGED
|
@@ -1,56 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"data-tooltip-type": type
|
|
29
|
-
}, children, options.showContent && (title || description) && /*#__PURE__*/React.createElement("div", {
|
|
30
|
-
"data-testid": testId + "-content"
|
|
31
|
-
}, title && /*#__PURE__*/React.createElement("div", {
|
|
32
|
-
"data-testid": testId + "-title"
|
|
33
|
-
}, title), description && /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
"data-testid": testId + "-description"
|
|
35
|
-
}, description)));
|
|
36
|
-
})
|
|
37
|
-
};
|
|
38
|
-
};
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
const tooltipMockFactory = (options = {}) => () => ({
|
|
3
|
+
default: vi.fn(({
|
|
4
|
+
children,
|
|
5
|
+
title,
|
|
6
|
+
description,
|
|
7
|
+
type,
|
|
8
|
+
"data-testid": dataTestId
|
|
9
|
+
}) => {
|
|
10
|
+
const testId = dataTestId || "ds-tooltip";
|
|
11
|
+
return /* @__PURE__ */ jsxs("span", { "data-testid": testId, "data-tooltip-type": type, children: [
|
|
12
|
+
children,
|
|
13
|
+
options.showContent && (title || description) && /* @__PURE__ */ jsxs("div", { "data-testid": `${testId}-content`, children: [
|
|
14
|
+
title && /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-title`, children: title }),
|
|
15
|
+
description && /* @__PURE__ */ jsx("div", { "data-testid": `${testId}-description`, children: description })
|
|
16
|
+
] })
|
|
17
|
+
] });
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
const tooltipMinimalMockFactory = () => ({
|
|
21
|
+
default: vi.fn(({
|
|
22
|
+
children
|
|
23
|
+
}) => /* @__PURE__ */ jsx(Fragment, { children }))
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
tooltipMinimalMockFactory,
|
|
27
|
+
tooltipMockFactory
|
|
39
28
|
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Factory function for minimal Tooltip mock.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* vi.mock('@synerise/ds-tooltip', tooltipMinimalMockFactory);
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export var tooltipMinimalMockFactory = function tooltipMinimalMockFactory() {
|
|
50
|
-
return {
|
|
51
|
-
"default": vi.fn(function (_ref2) {
|
|
52
|
-
var children = _ref2.children;
|
|
53
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
54
|
-
})
|
|
55
|
-
};
|
|
56
|
-
};
|