@transferwise/components 46.79.0 → 46.80.0
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/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/dateUtils/getDateView/getDateView.js +10 -0
- package/build/common/dateUtils/getDateView/getDateView.js.map +1 -0
- package/build/common/dateUtils/getDateView/getDateView.mjs +8 -0
- package/build/common/dateUtils/getDateView/getDateView.mjs.map +1 -0
- package/build/dateLookup/DateLookup.js +6 -6
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +6 -6
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js +4 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs +4 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.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/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/dateUtils/getDateView/getDateView.d.ts +2 -0
- package/build/types/common/dateUtils/getDateView/getDateView.d.ts.map +1 -0
- package/build/types/common/dateUtils/index.d.ts +1 -0
- package/build/types/common/dateUtils/index.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts +1 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +158 -0
- package/build/types/test-utils/index.d.ts.map +1 -0
- package/build/types/test-utils/jest.setup.d.ts +2 -0
- package/build/types/test-utils/jest.setup.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/button/{Button.spec.js → Button.spec.tsx} +3 -2
- package/src/button/Button.tsx +1 -1
- package/src/button/legacyUtils/{legacyUtils.spec.js → legacyUtils.spec.tsx} +1 -1
- package/src/button/legacyUtils/legacyUtils.ts +2 -2
- package/src/common/dateUtils/getDateView/getDateView.ts +5 -0
- package/src/common/dateUtils/index.ts +1 -0
- package/src/dateLookup/DateLookup.tests.story.tsx +40 -5
- package/src/dateLookup/DateLookup.tsx +9 -11
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.tsx +5 -2
- package/src/i18n/th.json +5 -0
- package/src/modal/{Modal.rtl.spec.js → Modal.rtl.spec.tsx} +8 -7
- package/src/slidingPanel/SlidingPanel.spec.js +1 -1
- package/src/ssr.spec.tsx +264 -0
- package/src/test-utils/{index.js → index.tsx} +11 -6
- package/src/test-utils/{jest.setup.js → jest.setup.ts} +13 -8
- package/src/ssr.spec.js +0 -256
- /package/src/button/__snapshots__/{Button.spec.js.snap → Button.spec.tsx.snap} +0 -0
- /package/src/dimmer/{Dimmer.rtl.spec.js → Dimmer.rtl.spec.tsx} +0 -0
- /package/src/info/{Info.spec.js → Info.spec.jsx} +0 -0
package/src/ssr.spec.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
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
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|