@transferwise/components 0.0.0-experimental-bb32303 → 0.0.0-experimental-d11e9c5
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/build/avatar/Avatar.js +3 -0
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +3 -0
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarView/AvatarView.js +163 -0
- package/build/avatarView/AvatarView.js.map +1 -0
- package/build/avatarView/AvatarView.mjs +161 -0
- package/build/avatarView/AvatarView.mjs.map +1 -0
- package/build/avatarView/NotificationDot.js +59 -0
- package/build/avatarView/NotificationDot.js.map +1 -0
- package/build/avatarView/NotificationDot.mjs +57 -0
- package/build/avatarView/NotificationDot.mjs.map +1 -0
- package/build/avatarWrapper/AvatarWrapper.js +10 -4
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +10 -4
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +3 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +3 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/badge/BadgeAssets.js +85 -0
- package/build/badge/BadgeAssets.js.map +1 -0
- package/build/badge/BadgeAssets.mjs +83 -0
- package/build/badge/BadgeAssets.mjs.map +1 -0
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/common/circle/Circle.js +17 -1
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +17 -1
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/i18n/th.json +5 -0
- package/build/i18n/th.json.js +5 -0
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +5 -0
- package/build/i18n/th.json.mjs.map +1 -1
- package/build/index.js +128 -121
- package/build/index.js.map +1 -1
- package/build/index.mjs +33 -29
- package/build/index.mjs.map +1 -1
- package/build/main.css +109 -5
- package/build/styles/avatarGroup/AvatarGroup.css +29 -0
- package/build/styles/avatarView/AvatarView.css +42 -0
- package/build/styles/avatarView/NotificationDot.css +20 -0
- package/build/styles/badge/Badge.css +6 -5
- package/build/styles/common/circle/Circle.css +32 -0
- package/build/styles/main.css +109 -5
- package/build/types/avatar/Avatar.d.ts +3 -0
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatarGroup/AvatarGroup.d.ts +18 -0
- package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
- package/build/types/avatarGroup/index.d.ts +3 -0
- package/build/types/avatarGroup/index.d.ts.map +1 -0
- package/build/types/avatarView/AvatarView.d.ts +19 -0
- package/build/types/avatarView/AvatarView.d.ts.map +1 -0
- package/build/types/avatarView/NotificationDot.d.ts +8 -0
- package/build/types/avatarView/NotificationDot.d.ts.map +1 -0
- package/build/types/avatarView/index.d.ts +3 -0
- package/build/types/avatarView/index.d.ts.map +1 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +5 -1
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/badge/BadgeAssets.d.ts +15 -0
- package/build/types/badge/BadgeAssets.d.ts.map +1 -0
- package/build/types/badge/index.d.ts +2 -0
- package/build/types/badge/index.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
- package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +2 -0
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/avatar/Avatar.tsx +3 -0
- package/src/avatarGroup/AvatarGroup.css +29 -0
- package/src/avatarGroup/AvatarGroup.less +42 -0
- package/src/avatarGroup/AvatarGroup.story.tsx +284 -0
- package/src/avatarGroup/AvatarGroup.tsx +117 -0
- package/src/avatarGroup/index.ts +2 -0
- package/src/avatarView/AvatarView.css +42 -0
- package/src/avatarView/AvatarView.less +33 -0
- package/src/avatarView/AvatarView.story.tsx +425 -0
- package/src/avatarView/AvatarView.tsx +141 -0
- package/src/avatarView/NotificationDot.css +20 -0
- package/src/avatarView/NotificationDot.less +24 -0
- package/src/avatarView/NotificationDot.tsx +35 -0
- package/src/avatarView/index.ts +2 -0
- package/src/avatarWrapper/AvatarWrapper.tsx +3 -0
- package/src/badge/Badge.css +6 -5
- package/src/badge/Badge.less +4 -3
- package/src/badge/Badge.tsx +8 -1
- package/src/badge/BadgeAssets.tsx +65 -0
- package/src/badge/index.ts +3 -0
- package/src/button/{Button.spec.tsx → Button.spec.js} +2 -3
- package/src/button/Button.tsx +1 -1
- package/src/button/legacyUtils/{legacyUtils.spec.tsx → legacyUtils.spec.js} +1 -1
- package/src/button/legacyUtils/legacyUtils.ts +2 -2
- package/src/common/circle/Circle.css +32 -0
- package/src/common/circle/Circle.less +35 -0
- package/src/common/circle/Circle.tsx +22 -1
- package/src/decision/Decision.story.tsx +10 -46
- package/src/flowNavigation/FlowNavigation.story.tsx +10 -48
- package/src/i18n/th.json +5 -0
- package/src/index.ts +4 -0
- package/src/listItem/ListItem.story.tsx +5 -43
- package/src/main.css +109 -5
- package/src/main.less +2 -0
- package/src/modal/{Modal.rtl.spec.tsx → Modal.rtl.spec.js} +7 -8
- package/src/navigationOption/NavigationOption.story.tsx +14 -65
- package/src/overlayHeader/OverlayHeader.story.tsx +5 -10
- package/src/radio/Radio.story.tsx +5 -5
- package/src/radioGroup/RadioGroup.story.tsx +3 -3
- package/src/selectOption/SelectOption.story.tsx +31 -30
- package/src/slidingPanel/SlidingPanel.spec.js +1 -1
- package/src/ssr.spec.js +256 -0
- package/src/test-utils/{index.tsx → index.js} +6 -11
- package/src/test-utils/{jest.setup.ts → jest.setup.js} +8 -13
- package/src/tile/Tile.story.tsx +2 -6
- package/build/types/test-utils/index.d.ts +0 -158
- package/build/types/test-utils/index.d.ts.map +0 -1
- package/build/types/test-utils/jest.setup.d.ts +0 -2
- package/build/types/test-utils/jest.setup.d.ts.map +0 -1
- package/src/ssr.spec.tsx +0 -264
- /package/src/button/__snapshots__/{Button.spec.tsx.snap → Button.spec.js.snap} +0 -0
- /package/src/dimmer/{Dimmer.rtl.spec.tsx → Dimmer.rtl.spec.js} +0 -0
- /package/src/info/{Info.spec.jsx → Info.spec.js} +0 -0
package/src/ssr.spec.js
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment node
|
|
3
|
+
*/
|
|
4
|
+
import { renderToString } from 'react-dom/server';
|
|
5
|
+
|
|
6
|
+
import en from './i18n/en.json';
|
|
7
|
+
|
|
8
|
+
import * as exposedLibraryItems from '.';
|
|
9
|
+
|
|
10
|
+
const excluded = new Set([
|
|
11
|
+
// hooks
|
|
12
|
+
'useSnackbar',
|
|
13
|
+
'useDirection',
|
|
14
|
+
'useLayout',
|
|
15
|
+
'useScreenSize',
|
|
16
|
+
|
|
17
|
+
// specific components
|
|
18
|
+
'Provider',
|
|
19
|
+
'BottomSheet',
|
|
20
|
+
'DropFade',
|
|
21
|
+
'SelectInputTriggerButton',
|
|
22
|
+
'Panel',
|
|
23
|
+
'ResponsivePanel',
|
|
24
|
+
|
|
25
|
+
// enums
|
|
26
|
+
'Size',
|
|
27
|
+
'Width',
|
|
28
|
+
'Sentiment',
|
|
29
|
+
'Variant',
|
|
30
|
+
'Priority',
|
|
31
|
+
'ControlType',
|
|
32
|
+
'Type',
|
|
33
|
+
'Theme',
|
|
34
|
+
'DateMode',
|
|
35
|
+
'MonthFormat',
|
|
36
|
+
'Position',
|
|
37
|
+
'Scroll',
|
|
38
|
+
'ProfileType',
|
|
39
|
+
'Breakpoint',
|
|
40
|
+
'Layout',
|
|
41
|
+
'Status',
|
|
42
|
+
'MarkdownNodeType',
|
|
43
|
+
'AvatarType',
|
|
44
|
+
'InfoPresentation',
|
|
45
|
+
'UploadStep',
|
|
46
|
+
'DecisionPresentation',
|
|
47
|
+
'DecisionType',
|
|
48
|
+
'AlertArrowPosition',
|
|
49
|
+
'LogoType',
|
|
50
|
+
'FileType',
|
|
51
|
+
'Direction',
|
|
52
|
+
'Typography',
|
|
53
|
+
|
|
54
|
+
// types
|
|
55
|
+
'SearchInputProps',
|
|
56
|
+
'SelectInputItem',
|
|
57
|
+
'SelectInputOptionContentProps',
|
|
58
|
+
'SelectInputProps',
|
|
59
|
+
'UploadedFile',
|
|
60
|
+
'UploadError',
|
|
61
|
+
'UploadResponse',
|
|
62
|
+
'LayoutDirection',
|
|
63
|
+
|
|
64
|
+
// utils
|
|
65
|
+
'SUPPORTED_LANGUAGES',
|
|
66
|
+
'RTL_LANGUAGES',
|
|
67
|
+
'DEFAULT_LANG',
|
|
68
|
+
'DEFAULT_LOCALE',
|
|
69
|
+
'adjustLocale',
|
|
70
|
+
'getLangFromLocale',
|
|
71
|
+
'getCountryFromLocale',
|
|
72
|
+
'getDirectionFromLocale',
|
|
73
|
+
'isServerSide',
|
|
74
|
+
'isBrowser',
|
|
75
|
+
|
|
76
|
+
// other
|
|
77
|
+
'translations',
|
|
78
|
+
]);
|
|
79
|
+
|
|
80
|
+
function isNotExcluded(item) {
|
|
81
|
+
return !excluded.has(item);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
describe('Server side rendering', () => {
|
|
85
|
+
it('can render components', () => {
|
|
86
|
+
const componentNames = Object.keys(exposedLibraryItems).filter(isNotExcluded);
|
|
87
|
+
expect(componentNames.length).toBeGreaterThan(0);
|
|
88
|
+
|
|
89
|
+
// stick all possible properties we might need to render all components in here
|
|
90
|
+
const allProps = {
|
|
91
|
+
currencies: [],
|
|
92
|
+
steps: [],
|
|
93
|
+
stepper: {
|
|
94
|
+
steps: [],
|
|
95
|
+
},
|
|
96
|
+
items: [],
|
|
97
|
+
children: 'yo',
|
|
98
|
+
id: '1',
|
|
99
|
+
text: 'test',
|
|
100
|
+
timeout: 0,
|
|
101
|
+
timestamp: 1,
|
|
102
|
+
title: 'trolo',
|
|
103
|
+
name: 'lolo',
|
|
104
|
+
label: 'hello',
|
|
105
|
+
content: 'world',
|
|
106
|
+
currency: 'XYZ',
|
|
107
|
+
amount: 0,
|
|
108
|
+
options: [],
|
|
109
|
+
model: {},
|
|
110
|
+
fields: {},
|
|
111
|
+
media: <h1>Hello</h1>,
|
|
112
|
+
onClick: jest.fn(),
|
|
113
|
+
onChange: jest.fn(),
|
|
114
|
+
status: 'processing',
|
|
115
|
+
size: 'sm',
|
|
116
|
+
body: 'body',
|
|
117
|
+
onClose: jest.fn(),
|
|
118
|
+
onDismiss: jest.fn(),
|
|
119
|
+
onRemove: jest.fn(),
|
|
120
|
+
radios: [
|
|
121
|
+
{
|
|
122
|
+
id: 'id-test-0',
|
|
123
|
+
label: 'Radio1',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 'id-test-0',
|
|
127
|
+
label: 'Radio1',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
position: 'left',
|
|
131
|
+
open: true,
|
|
132
|
+
tabs: [],
|
|
133
|
+
direction: {
|
|
134
|
+
xs: 'column',
|
|
135
|
+
sm: 'row',
|
|
136
|
+
md: 'column',
|
|
137
|
+
lg: 'row',
|
|
138
|
+
},
|
|
139
|
+
alt: '',
|
|
140
|
+
src: '',
|
|
141
|
+
details: 'yo',
|
|
142
|
+
icon: <svg />,
|
|
143
|
+
badge: <svg />,
|
|
144
|
+
link: 'link',
|
|
145
|
+
href: '#',
|
|
146
|
+
description: 'description',
|
|
147
|
+
'aria-label': 'a label',
|
|
148
|
+
logo: <svg />,
|
|
149
|
+
chips: [
|
|
150
|
+
{
|
|
151
|
+
value: 1,
|
|
152
|
+
label: 'One',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
value: 2,
|
|
156
|
+
label: 'Two',
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
segments: [
|
|
160
|
+
{
|
|
161
|
+
id: '1',
|
|
162
|
+
value: 'accounting',
|
|
163
|
+
label: 'Accounting',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: '2',
|
|
167
|
+
value: 'payroll',
|
|
168
|
+
label: 'Payroll',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: '3',
|
|
172
|
+
value: 'reporting',
|
|
173
|
+
label: 'Reporting',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// Override props in case of name collision.
|
|
179
|
+
const overrideProps = {
|
|
180
|
+
Alert: { children: undefined, message: 'Fluffy kittens', size: undefined },
|
|
181
|
+
Card: { isExpanded: true },
|
|
182
|
+
CheckboxButton: { children: undefined, onChange: jest.fn() },
|
|
183
|
+
Typeahead: { size: 'md' },
|
|
184
|
+
InputWithDisplayFormat: { displayPattern: '**-**' },
|
|
185
|
+
TextareaWithDisplayFormat: { displayPattern: '**-**' },
|
|
186
|
+
Sticky: { position: 'top' },
|
|
187
|
+
MoneyInput: { selectedCurrency: { currency: 'EUR' } },
|
|
188
|
+
Tabs: { selected: 1, onTabSelect: jest.fn() },
|
|
189
|
+
Markdown: { children: '# Markdown string' },
|
|
190
|
+
SnackbarConsumer: {
|
|
191
|
+
children: jest.fn(),
|
|
192
|
+
},
|
|
193
|
+
SnackbarContext: {
|
|
194
|
+
children: jest.fn(),
|
|
195
|
+
},
|
|
196
|
+
Popover: {
|
|
197
|
+
children: <div />,
|
|
198
|
+
},
|
|
199
|
+
Progress: {
|
|
200
|
+
progress: { value: 50, max: 100 },
|
|
201
|
+
},
|
|
202
|
+
ProgressBar: {
|
|
203
|
+
progress: { value: 50, max: 100 },
|
|
204
|
+
},
|
|
205
|
+
Field: {
|
|
206
|
+
model: 'a model',
|
|
207
|
+
type: 'text',
|
|
208
|
+
children: <input />,
|
|
209
|
+
},
|
|
210
|
+
Input: {
|
|
211
|
+
children: undefined,
|
|
212
|
+
},
|
|
213
|
+
SearchInput: {
|
|
214
|
+
children: undefined,
|
|
215
|
+
},
|
|
216
|
+
TextArea: {
|
|
217
|
+
children: undefined,
|
|
218
|
+
},
|
|
219
|
+
Summary: {
|
|
220
|
+
status: 'done',
|
|
221
|
+
content: undefined,
|
|
222
|
+
},
|
|
223
|
+
Tile: {
|
|
224
|
+
media: <img alt="img" />,
|
|
225
|
+
},
|
|
226
|
+
Modal: { position: 'top' },
|
|
227
|
+
ActionOption: { action: 'hello' },
|
|
228
|
+
DateLookup: { value: new Date() },
|
|
229
|
+
Link: { size: 16 },
|
|
230
|
+
Tooltip: { children: <>yo</> },
|
|
231
|
+
SelectOption: { placeholder: { media: <img alt="img" /> } },
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const { Provider } = exposedLibraryItems;
|
|
235
|
+
componentNames.forEach((componentName) => {
|
|
236
|
+
const Component = exposedLibraryItems[componentName];
|
|
237
|
+
const newProps = { ...allProps };
|
|
238
|
+
|
|
239
|
+
Object.keys(overrideProps[componentName] || {}).forEach((propertyToOverrideKey) => {
|
|
240
|
+
newProps[propertyToOverrideKey] = overrideProps[componentName][propertyToOverrideKey];
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
const view = renderToString(
|
|
244
|
+
<Provider i18n={{ locale: 'en-GB', messages: en }}>
|
|
245
|
+
{componentName.endsWith('Context') ? (
|
|
246
|
+
<Component.Provider {...newProps} />
|
|
247
|
+
) : (
|
|
248
|
+
<Component {...newProps} />
|
|
249
|
+
)}
|
|
250
|
+
</Provider>,
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
expect(view).toStrictEqual(expect.any(String));
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ReactElement, FC } from 'react';
|
|
2
1
|
import { render, renderHook } from '@testing-library/react';
|
|
3
2
|
import { userEvent } from '@testing-library/user-event';
|
|
4
3
|
|
|
5
4
|
import { Provider } from '..';
|
|
6
|
-
import { DEFAULT_LOCALE } from '../common';
|
|
5
|
+
import { DEFAULT_LOCALE } from '../common/locale';
|
|
7
6
|
import en from '../i18n/en.json';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -11,11 +10,9 @@ import en from '../i18n/en.json';
|
|
|
11
10
|
* Source: https://testing-library.com/docs/example-react-intl/#creating-a-custom-render-function
|
|
12
11
|
*
|
|
13
12
|
*/
|
|
14
|
-
function customRender(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
): ReturnType<typeof render> {
|
|
18
|
-
const Wrapper: FC<{ children: React.ReactNode }> = ({ children }) => {
|
|
13
|
+
function customRender(ui, { locale = DEFAULT_LOCALE, messages = en, ...renderOptions } = {}) {
|
|
14
|
+
// eslint-disable-next-line react/prop-types
|
|
15
|
+
const Wrapper = ({ children }) => {
|
|
19
16
|
return <Provider i18n={{ locale, messages }}>{children}</Provider>;
|
|
20
17
|
};
|
|
21
18
|
return render(ui, { wrapper: Wrapper, ...renderOptions });
|
|
@@ -24,11 +21,9 @@ function customRender(
|
|
|
24
21
|
/**
|
|
25
22
|
* Custom `renderHook` function which wraps passed elements in Provider component
|
|
26
23
|
* For more info: https://react-hooks-testing-library.com/usage/advanced-hooks#context
|
|
24
|
+
*
|
|
27
25
|
*/
|
|
28
|
-
function customRenderHook(
|
|
29
|
-
callback: () => unknown,
|
|
30
|
-
{ locale = DEFAULT_LOCALE, messages = en } = {},
|
|
31
|
-
) {
|
|
26
|
+
function customRenderHook(callback, { locale = DEFAULT_LOCALE, messages = en } = {}) {
|
|
32
27
|
return renderHook(callback, {
|
|
33
28
|
wrapper: ({ children }) => <Provider i18n={{ locale, messages }}>{children}</Provider>,
|
|
34
29
|
});
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import '@testing-library/jest-dom';
|
|
1
|
+
require('@testing-library/jest-dom');
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const { default: Adapter } = require('@cfaester/enzyme-adapter-react-18');
|
|
4
|
+
const Enzyme = require('enzyme');
|
|
5
|
+
const util = require('node:util');
|
|
7
6
|
|
|
8
|
-
global.fetch =
|
|
7
|
+
global.fetch = require('jest-fetch-mock');
|
|
9
8
|
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
11
9
|
Enzyme.configure({ adapter: new Adapter() });
|
|
12
10
|
|
|
13
|
-
global.requestAnimationFrame = (callback
|
|
14
|
-
callback(performance.now());
|
|
15
|
-
return 0;
|
|
16
|
-
};
|
|
11
|
+
global.requestAnimationFrame = (callback) => callback();
|
|
17
12
|
|
|
18
13
|
Object.defineProperty(global, 'TextEncoder', {
|
|
19
14
|
value: util.TextEncoder,
|
|
@@ -23,7 +18,7 @@ Object.defineProperty(global, 'TextEncoder', {
|
|
|
23
18
|
// This mock will make tests fail when props error occurs.
|
|
24
19
|
const { error, warn } = console;
|
|
25
20
|
// eslint-disable-next-line no-console
|
|
26
|
-
console.error = (message
|
|
21
|
+
console.error = (message, ...args) => {
|
|
27
22
|
if (/(Invalid prop|Failed prop type)/i.test(message)) {
|
|
28
23
|
throw new Error(message);
|
|
29
24
|
}
|
|
@@ -32,7 +27,7 @@ console.error = (message: string, ...args: unknown[]): void => {
|
|
|
32
27
|
};
|
|
33
28
|
|
|
34
29
|
// eslint-disable-next-line no-console
|
|
35
|
-
console.warn = (message
|
|
30
|
+
console.warn = (message, ...args) => {
|
|
36
31
|
if (/(Call to useTheme outside a ThemeProvider)/i.test(message)) {
|
|
37
32
|
return;
|
|
38
33
|
}
|
package/src/tile/Tile.story.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
2
|
import { text, boolean } from '@storybook/addon-knobs';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import AvatarView from '../avatarView';
|
|
5
5
|
import { Size } from '../common';
|
|
6
6
|
|
|
7
7
|
import Tile from '.';
|
|
@@ -41,11 +41,7 @@ export const Basic = () => {
|
|
|
41
41
|
description={description}
|
|
42
42
|
disabled={disabled}
|
|
43
43
|
href="#href1"
|
|
44
|
-
media={
|
|
45
|
-
<Avatar size="md" type="initials">
|
|
46
|
-
HM
|
|
47
|
-
</Avatar>
|
|
48
|
-
}
|
|
44
|
+
media={<AvatarView name="Henry Mike" />}
|
|
49
45
|
size={medium ? Size.MEDIUM : Size.SMALL}
|
|
50
46
|
title={title}
|
|
51
47
|
onClick={action('onClick')}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import { userEvent } from '@testing-library/user-event';
|
|
4
|
-
/**
|
|
5
|
-
* Custom `render` function which wraps passed elements in Provider component
|
|
6
|
-
* Source: https://testing-library.com/docs/example-react-intl/#creating-a-custom-render-function
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
declare function customRender(ui: ReactElement, { locale, messages, ...renderOptions }?: {
|
|
10
|
-
locale?: string | undefined;
|
|
11
|
-
messages?: {
|
|
12
|
-
"neptune.Button.loadingAriaLabel": string;
|
|
13
|
-
"neptune.Chips.ariaLabel": string;
|
|
14
|
-
"neptune.ClearButton.ariaLabel": string;
|
|
15
|
-
"neptune.CloseButton.ariaLabel": string;
|
|
16
|
-
"neptune.DateInput.day.label": string;
|
|
17
|
-
"neptune.DateInput.day.placeholder": string;
|
|
18
|
-
"neptune.DateInput.month.label": string;
|
|
19
|
-
"neptune.DateInput.year.label": string;
|
|
20
|
-
"neptune.DateInput.year.placeholder": string;
|
|
21
|
-
"neptune.DateLookup.day": string;
|
|
22
|
-
"neptune.DateLookup.goTo20YearView": string;
|
|
23
|
-
"neptune.DateLookup.month": string;
|
|
24
|
-
"neptune.DateLookup.next": string;
|
|
25
|
-
"neptune.DateLookup.previous": string;
|
|
26
|
-
"neptune.DateLookup.selected": string;
|
|
27
|
-
"neptune.DateLookup.twentyYears": string;
|
|
28
|
-
"neptune.DateLookup.year": string;
|
|
29
|
-
"neptune.FlowNavigation.back": string;
|
|
30
|
-
"neptune.Info.ariaLabel": string;
|
|
31
|
-
"neptune.Label.optional": string;
|
|
32
|
-
"neptune.Link.opensInNewTab": string;
|
|
33
|
-
"neptune.MoneyInput.Select.placeholder": string;
|
|
34
|
-
"neptune.MoneyInput.Select.selectCurrencyLabel": string;
|
|
35
|
-
"neptune.PhoneNumberInput.SelectInput.placeholder": string;
|
|
36
|
-
"neptune.Select.searchPlaceholder": string;
|
|
37
|
-
"neptune.SelectInput.noResultsFound": string;
|
|
38
|
-
"neptune.SelectOption.action.label": string;
|
|
39
|
-
"neptune.SelectOption.selected.action.label": string;
|
|
40
|
-
"neptune.StatusIcon.iconLabel.error": string;
|
|
41
|
-
"neptune.StatusIcon.iconLabel.information": string;
|
|
42
|
-
"neptune.StatusIcon.iconLabel.pending": string;
|
|
43
|
-
"neptune.StatusIcon.iconLabel.success": string;
|
|
44
|
-
"neptune.StatusIcon.iconLabel.warning": string;
|
|
45
|
-
"neptune.Summary.statusDone": string;
|
|
46
|
-
"neptune.Summary.statusNotDone": string;
|
|
47
|
-
"neptune.Summary.statusPending": string;
|
|
48
|
-
"neptune.Upload.csButtonText": string;
|
|
49
|
-
"neptune.Upload.csFailureText": string;
|
|
50
|
-
"neptune.Upload.csSuccessText": string;
|
|
51
|
-
"neptune.Upload.csTooLargeMessage": string;
|
|
52
|
-
"neptune.Upload.csWrongTypeMessage": string;
|
|
53
|
-
"neptune.Upload.psButtonText": string;
|
|
54
|
-
"neptune.Upload.psProcessingText": string;
|
|
55
|
-
"neptune.Upload.retry": string;
|
|
56
|
-
"neptune.Upload.usButtonText": string;
|
|
57
|
-
"neptune.Upload.usDropMessage": string;
|
|
58
|
-
"neptune.Upload.usPlaceholder": string;
|
|
59
|
-
"neptune.UploadButton.allFileTypes": string;
|
|
60
|
-
"neptune.UploadButton.dropFiles": string;
|
|
61
|
-
"neptune.UploadButton.instructions": string;
|
|
62
|
-
"neptune.UploadButton.uploadFile": string;
|
|
63
|
-
"neptune.UploadButton.uploadFiles": string;
|
|
64
|
-
"neptune.UploadInput.deleteModalBody": string;
|
|
65
|
-
"neptune.UploadInput.deleteModalCancelButtonText": string;
|
|
66
|
-
"neptune.UploadInput.deleteModalConfirmButtonText": string;
|
|
67
|
-
"neptune.UploadInput.deleteModalTitle": string;
|
|
68
|
-
"neptune.UploadInput.fileIsTooLarge": string;
|
|
69
|
-
"neptune.UploadInput.fileTypeNotSupported": string;
|
|
70
|
-
"neptune.UploadInput.maximumFilesAlreadyUploaded": string;
|
|
71
|
-
"neptune.UploadItem.deleting": string;
|
|
72
|
-
"neptune.UploadItem.removeFile": string;
|
|
73
|
-
"neptune.UploadItem.uploaded": string;
|
|
74
|
-
"neptune.UploadItem.uploadedFile": string;
|
|
75
|
-
"neptune.UploadItem.uploading": string;
|
|
76
|
-
"neptune.UploadItem.uploadingFailed": string;
|
|
77
|
-
} | undefined;
|
|
78
|
-
}): ReturnType<typeof render>;
|
|
79
|
-
/**
|
|
80
|
-
* Custom `renderHook` function which wraps passed elements in Provider component
|
|
81
|
-
* For more info: https://react-hooks-testing-library.com/usage/advanced-hooks#context
|
|
82
|
-
*/
|
|
83
|
-
declare function customRenderHook(callback: () => unknown, { locale, messages }?: {
|
|
84
|
-
locale?: string | undefined;
|
|
85
|
-
messages?: {
|
|
86
|
-
"neptune.Button.loadingAriaLabel": string;
|
|
87
|
-
"neptune.Chips.ariaLabel": string;
|
|
88
|
-
"neptune.ClearButton.ariaLabel": string;
|
|
89
|
-
"neptune.CloseButton.ariaLabel": string;
|
|
90
|
-
"neptune.DateInput.day.label": string;
|
|
91
|
-
"neptune.DateInput.day.placeholder": string;
|
|
92
|
-
"neptune.DateInput.month.label": string;
|
|
93
|
-
"neptune.DateInput.year.label": string;
|
|
94
|
-
"neptune.DateInput.year.placeholder": string;
|
|
95
|
-
"neptune.DateLookup.day": string;
|
|
96
|
-
"neptune.DateLookup.goTo20YearView": string;
|
|
97
|
-
"neptune.DateLookup.month": string;
|
|
98
|
-
"neptune.DateLookup.next": string;
|
|
99
|
-
"neptune.DateLookup.previous": string;
|
|
100
|
-
"neptune.DateLookup.selected": string;
|
|
101
|
-
"neptune.DateLookup.twentyYears": string;
|
|
102
|
-
"neptune.DateLookup.year": string;
|
|
103
|
-
"neptune.FlowNavigation.back": string;
|
|
104
|
-
"neptune.Info.ariaLabel": string;
|
|
105
|
-
"neptune.Label.optional": string;
|
|
106
|
-
"neptune.Link.opensInNewTab": string;
|
|
107
|
-
"neptune.MoneyInput.Select.placeholder": string;
|
|
108
|
-
"neptune.MoneyInput.Select.selectCurrencyLabel": string;
|
|
109
|
-
"neptune.PhoneNumberInput.SelectInput.placeholder": string;
|
|
110
|
-
"neptune.Select.searchPlaceholder": string;
|
|
111
|
-
"neptune.SelectInput.noResultsFound": string;
|
|
112
|
-
"neptune.SelectOption.action.label": string;
|
|
113
|
-
"neptune.SelectOption.selected.action.label": string;
|
|
114
|
-
"neptune.StatusIcon.iconLabel.error": string;
|
|
115
|
-
"neptune.StatusIcon.iconLabel.information": string;
|
|
116
|
-
"neptune.StatusIcon.iconLabel.pending": string;
|
|
117
|
-
"neptune.StatusIcon.iconLabel.success": string;
|
|
118
|
-
"neptune.StatusIcon.iconLabel.warning": string;
|
|
119
|
-
"neptune.Summary.statusDone": string;
|
|
120
|
-
"neptune.Summary.statusNotDone": string;
|
|
121
|
-
"neptune.Summary.statusPending": string;
|
|
122
|
-
"neptune.Upload.csButtonText": string;
|
|
123
|
-
"neptune.Upload.csFailureText": string;
|
|
124
|
-
"neptune.Upload.csSuccessText": string;
|
|
125
|
-
"neptune.Upload.csTooLargeMessage": string;
|
|
126
|
-
"neptune.Upload.csWrongTypeMessage": string;
|
|
127
|
-
"neptune.Upload.psButtonText": string;
|
|
128
|
-
"neptune.Upload.psProcessingText": string;
|
|
129
|
-
"neptune.Upload.retry": string;
|
|
130
|
-
"neptune.Upload.usButtonText": string;
|
|
131
|
-
"neptune.Upload.usDropMessage": string;
|
|
132
|
-
"neptune.Upload.usPlaceholder": string;
|
|
133
|
-
"neptune.UploadButton.allFileTypes": string;
|
|
134
|
-
"neptune.UploadButton.dropFiles": string;
|
|
135
|
-
"neptune.UploadButton.instructions": string;
|
|
136
|
-
"neptune.UploadButton.uploadFile": string;
|
|
137
|
-
"neptune.UploadButton.uploadFiles": string;
|
|
138
|
-
"neptune.UploadInput.deleteModalBody": string;
|
|
139
|
-
"neptune.UploadInput.deleteModalCancelButtonText": string;
|
|
140
|
-
"neptune.UploadInput.deleteModalConfirmButtonText": string;
|
|
141
|
-
"neptune.UploadInput.deleteModalTitle": string;
|
|
142
|
-
"neptune.UploadInput.fileIsTooLarge": string;
|
|
143
|
-
"neptune.UploadInput.fileTypeNotSupported": string;
|
|
144
|
-
"neptune.UploadInput.maximumFilesAlreadyUploaded": string;
|
|
145
|
-
"neptune.UploadItem.deleting": string;
|
|
146
|
-
"neptune.UploadItem.removeFile": string;
|
|
147
|
-
"neptune.UploadItem.uploaded": string;
|
|
148
|
-
"neptune.UploadItem.uploadedFile": string;
|
|
149
|
-
"neptune.UploadItem.uploading": string;
|
|
150
|
-
"neptune.UploadItem.uploadingFailed": string;
|
|
151
|
-
} | undefined;
|
|
152
|
-
}): import("@testing-library/react").RenderHookResult<unknown, unknown>;
|
|
153
|
-
export * from '@testing-library/react';
|
|
154
|
-
export * from './fake-data';
|
|
155
|
-
export * from './story-config';
|
|
156
|
-
export * from './window-mock';
|
|
157
|
-
export { customRender as render, customRenderHook as renderHook, userEvent };
|
|
158
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,GAChE,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,MAAM,OAAO,EACvB,EAAE,MAAuB,EAAE,QAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,uEAKhD;AAED,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,gBAAgB,IAAI,UAAU,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../../src/test-utils/jest.setup.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAC"}
|