@transferwise/components 0.0.0-experimental-50e1f17 → 0.0.0-experimental-08d336e

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 (42) hide show
  1. package/build/index.esm.js +3327 -3404
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +3326 -3402
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +1 -1
  6. package/build/styles/logo/Logo.css +1 -1
  7. package/build/styles/main.css +1 -1
  8. package/build/styles/moneyInput/MoneyInput.css +1 -1
  9. package/build/types/common/hooks/useLayout/useLayout.d.ts +9 -6
  10. package/build/types/common/hooks/useLayout/useLayout.d.ts.map +1 -1
  11. package/build/types/index.d.ts +1 -0
  12. package/build/types/index.d.ts.map +1 -1
  13. package/build/types/inputs/SelectInput.d.ts +1 -2
  14. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  15. package/build/types/logo/Logo.d.ts.map +1 -1
  16. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  17. package/package.json +1 -1
  18. package/src/common/hooks/useLayout/useLayout.ts +21 -49
  19. package/src/common/responsivePanel/ResponsivePanel.spec.js +3 -1
  20. package/src/dateLookup/DateLookup.testingLibrary.spec.js +1 -19
  21. package/src/dateLookup/dateHeader/DateHeader.spec.js +2 -0
  22. package/src/drawer/Drawer.rtl.spec.js +3 -1
  23. package/src/drawer/Drawer.spec.js +2 -0
  24. package/src/index.ts +1 -0
  25. package/src/info/Info.spec.js +7 -11
  26. package/src/inputs/SelectInput.tsx +0 -8
  27. package/src/logo/Logo.css +1 -1
  28. package/src/logo/Logo.js +9 -18
  29. package/src/logo/Logo.less +21 -2
  30. package/src/logo/__snapshots__/Logo.spec.js.snap +168 -72
  31. package/src/main.css +1 -1
  32. package/src/modal/Modal.rtl.spec.js +3 -1
  33. package/src/modal/Modal.spec.js +2 -0
  34. package/src/modal/Modal.tsx +2 -2
  35. package/src/moneyInput/MoneyInput.css +1 -1
  36. package/src/moneyInput/MoneyInput.js +34 -82
  37. package/src/moneyInput/MoneyInput.less +28 -24
  38. package/src/moneyInput/MoneyInput.spec.js +112 -243
  39. package/src/moneyInput/MoneyInput.story.tsx +1 -51
  40. package/src/ssr.spec.js +1 -0
  41. package/src/uploadInput/UploadInput.spec.tsx +3 -1
  42. package/src/moneyInput/MoneyInput.rtl.spec.js +0 -71
@@ -1,10 +1,11 @@
1
+ import { render } from '@testing-library/react';
2
+ import userEvent from '@testing-library/user-event';
1
3
  import { shallow } from 'enzyme';
2
4
 
3
- import { MoneyInput, Title, Input, SelectInput } from '..';
4
- import { mockMatchMedia, mockResizeObserver } from '../test-utils';
5
+ import { Select, MoneyInput, Title, Input } from '..';
6
+ import { mockMatchMedia } from '../test-utils';
5
7
 
6
8
  mockMatchMedia();
7
- mockResizeObserver();
8
9
 
9
10
  jest.mock('./currencyFormatting', () => ({
10
11
  parseAmount: jest.fn(),
@@ -85,7 +86,7 @@ describe('Money Input', () => {
85
86
  });
86
87
 
87
88
  function currencySelect() {
88
- return component.find(SelectInput);
89
+ return component.find(Select);
89
90
  }
90
91
 
91
92
  function fixedCurrencyDisplay() {
@@ -98,11 +99,7 @@ describe('Money Input', () => {
98
99
  }
99
100
 
100
101
  function displayedCurrencies() {
101
- return currencySelect().prop('items');
102
- }
103
-
104
- function getFooter() {
105
- return currencySelect().prop('renderFooter');
102
+ return currencySelect().prop('options');
106
103
  }
107
104
 
108
105
  function amountInput() {
@@ -128,86 +125,31 @@ describe('Money Input', () => {
128
125
 
129
126
  it('renders a select with all the currencies as options', () => {
130
127
  expect(currencySelect()).toHaveLength(1);
131
- expect(displayedCurrencies()).toStrictEqual([
132
- {
133
- type: 'group',
134
- label: 'Popular currencies',
135
- options: [
136
- {
137
- type: 'option',
138
- value: {
139
- value: 'EUR',
140
- label: 'EUR',
141
- note: 'Euro',
142
- currency: 'eur',
143
- searchable: 'Spain, Germany, France, Austria, Estonia',
144
- },
145
- filterMatchers: ['EUR', 'EUR', 'Euro', 'Spain, Germany, France, Austria, Estonia'],
146
- },
147
- {
148
- type: 'option',
149
- value: {
150
- value: 'USD',
151
- label: 'USD',
152
- note: 'United States dollar',
153
- currency: 'usd',
154
- searchable: 'Hong Kong, Saudi Arabia',
155
- },
156
- filterMatchers: ['USD', 'USD', 'United States dollar', 'Hong Kong, Saudi Arabia'],
157
- },
158
- {
159
- type: 'option',
160
- value: {
161
- value: 'GBP',
162
- label: 'GBP',
163
- note: 'British pound',
164
- currency: 'gbp',
165
- searchable: 'England, Scotland, Wales',
166
- },
167
- filterMatchers: ['GBP', 'GBP', 'British pound', 'England, Scotland, Wales'],
168
- },
169
- ],
170
- },
171
- {
172
- type: 'group',
173
- label: 'Some other currencies',
174
- options: [
175
- {
176
- type: 'option',
177
- value: {
178
- value: 'CAD',
179
- label: 'CAD',
180
- note: 'Canadian dollar',
181
- currency: 'cad',
182
- },
183
- filterMatchers: ['CAD', 'CAD', 'Canadian dollar', undefined],
184
- },
185
- {
186
- type: 'option',
187
- value: {
188
- value: 'AUD',
189
- label: 'AUD',
190
- note: 'Australian dollar',
191
- currency: 'aud',
192
- },
193
- filterMatchers: ['AUD', 'AUD', 'Australian dollar', undefined],
194
- },
195
- ],
196
- },
197
- ]);
128
+ expect(displayedCurrencies()).toStrictEqual(props.currencies);
129
+ });
130
+
131
+ it('renders a Select component with expected id when id is provided', () => {
132
+ let componentWithId = shallow(<MoneyInput id="mock-id" {...props} />).dive();
133
+ const select = componentWithId.find('Select');
134
+
135
+ expect(select.prop('id')).toBe('mock-id-select');
198
136
  });
199
137
 
200
138
  it('renders Select component with undefined id when id is not provided', () => {
201
- const select = component.find('SelectInput');
139
+ const select = component.find('Select');
202
140
 
203
141
  expect(select.prop('id')).toBeUndefined();
204
142
  });
205
143
 
206
144
  it('shows the currently active currency as active and hides its note', () => {
207
- expect(currencySelect().prop('value')).toStrictEqual({
145
+ expect(currencySelect().prop('selected')).toStrictEqual({
208
146
  value: 'EUR',
209
- label: 'EUR',
210
- note: 'Euro',
147
+ label: (
148
+ <Title as="span" type="title-subsection" className="tw-money-input__text">
149
+ EUR
150
+ </Title>
151
+ ),
152
+ note: null,
211
153
  currency: 'eur',
212
154
  searchable: 'Spain, Germany, France, Austria, Estonia',
213
155
  });
@@ -231,7 +173,22 @@ describe('Money Input', () => {
231
173
  });
232
174
  });
233
175
 
176
+ it('configures the select visually correctly', () => {
177
+ const options = currencySelect().props();
178
+
179
+ expect(options.required).toBe(true);
180
+ expect(options.dropdownWidth).toBe('lg');
181
+ expect(options.inverse).toBe(true);
182
+ });
183
+
234
184
  describe('when searching', () => {
185
+ it('passes search value to currency select', () => {
186
+ expect(currencySelect().prop('searchValue')).toBe('');
187
+
188
+ searchCurrencies('EEK');
189
+ expect(currencySelect().prop('searchValue')).toBe('EEK');
190
+ });
191
+
235
192
  it('hides headers', () => {
236
193
  currencies = [
237
194
  { header: 'A currency' },
@@ -240,43 +197,12 @@ describe('Money Input', () => {
240
197
  { value: 'EUR', label: 'Euro' },
241
198
  ];
242
199
  component.setProps({ currencies });
243
- expect(displayedCurrencies()).toStrictEqual([
244
- {
245
- type: 'group',
246
- label: 'A currency',
247
- options: [
248
- {
249
- type: 'option',
250
- value: { value: 'GBP', label: 'British pound' },
251
- filterMatchers: ['GBP', 'British pound', undefined, undefined],
252
- },
253
- ],
254
- },
255
- {
256
- type: 'group',
257
- label: 'Another currency',
258
- options: [
259
- {
260
- type: 'option',
261
- value: { value: 'EUR', label: 'Euro' },
262
- filterMatchers: ['EUR', 'Euro', undefined, undefined],
263
- },
264
- ],
265
- },
266
- ]);
200
+ expect(displayedCurrencies()).toStrictEqual(currencies);
267
201
 
268
202
  searchCurrencies('O');
269
203
  expect(displayedCurrencies()).toStrictEqual([
270
- {
271
- type: 'option',
272
- value: { value: 'GBP', label: 'British pound' },
273
- filterMatchers: ['GBP', 'British pound', undefined, undefined],
274
- },
275
- {
276
- type: 'option',
277
- value: { value: 'EUR', label: 'Euro' },
278
- filterMatchers: ['EUR', 'Euro', undefined, undefined],
279
- },
204
+ { value: 'GBP', label: 'British pound' },
205
+ { value: 'EUR', label: 'Euro' },
280
206
  ]);
281
207
  });
282
208
 
@@ -286,27 +212,10 @@ describe('Money Input', () => {
286
212
  { value: 'EUR', label: 'Euro' },
287
213
  ];
288
214
  component.setProps({ currencies });
289
- expect(displayedCurrencies()).toStrictEqual([
290
- {
291
- type: 'option',
292
- value: { value: 'GBP', label: 'British pound' },
293
- filterMatchers: ['GBP', 'British pound', undefined, undefined],
294
- },
295
- {
296
- type: 'option',
297
- value: { value: 'EUR', label: 'Euro' },
298
- filterMatchers: ['EUR', 'Euro', undefined, undefined],
299
- },
300
- ]);
215
+ expect(displayedCurrencies()).toStrictEqual(currencies);
301
216
 
302
217
  searchCurrencies('P');
303
- expect(displayedCurrencies()).toStrictEqual([
304
- {
305
- type: 'option',
306
- value: { value: 'GBP', label: 'British pound' },
307
- filterMatchers: ['GBP', 'British pound', undefined, undefined],
308
- },
309
- ]);
218
+ expect(displayedCurrencies()).toStrictEqual([{ value: 'GBP', label: 'British pound' }]);
310
219
  });
311
220
 
312
221
  it('searches by note', () => {
@@ -315,27 +224,10 @@ describe('Money Input', () => {
315
224
  { value: 'EUR', note: 'Other money' },
316
225
  ];
317
226
  component.setProps({ currencies });
318
- expect(displayedCurrencies()).toStrictEqual([
319
- {
320
- type: 'option',
321
- value: { value: 'GBP', note: 'Queen money' },
322
- filterMatchers: ['GBP', undefined, 'Queen money', undefined],
323
- },
324
- {
325
- type: 'option',
326
- value: { value: 'EUR', note: 'Other money' },
327
- filterMatchers: ['EUR', undefined, 'Other money', undefined],
328
- },
329
- ]);
227
+ expect(displayedCurrencies()).toStrictEqual(currencies);
330
228
 
331
229
  searchCurrencies('Other');
332
- expect(displayedCurrencies()).toStrictEqual([
333
- {
334
- type: 'option',
335
- value: { value: 'EUR', note: 'Other money' },
336
- filterMatchers: ['EUR', undefined, 'Other money', undefined],
337
- },
338
- ]);
230
+ expect(displayedCurrencies()).toStrictEqual([{ value: 'EUR', note: 'Other money' }]);
339
231
  });
340
232
 
341
233
  it('searches by searchable string', () => {
@@ -344,26 +236,11 @@ describe('Money Input', () => {
344
236
  { value: 'EUR', searchable: 'Europe' },
345
237
  ];
346
238
  component.setProps({ currencies });
347
- expect(displayedCurrencies()).toStrictEqual([
348
- {
349
- type: 'option',
350
- value: { value: 'GBP', searchable: 'Great Britain, United Kingdom' },
351
- filterMatchers: ['GBP', undefined, undefined, 'Great Britain, United Kingdom'],
352
- },
353
- {
354
- type: 'option',
355
- value: { value: 'EUR', searchable: 'Europe' },
356
- filterMatchers: ['EUR', undefined, undefined, 'Europe'],
357
- },
358
- ]);
239
+ expect(displayedCurrencies()).toStrictEqual(currencies);
359
240
 
360
241
  searchCurrencies('Britain');
361
242
  expect(displayedCurrencies()).toStrictEqual([
362
- {
363
- type: 'option',
364
- value: { value: 'GBP', searchable: 'Great Britain, United Kingdom' },
365
- filterMatchers: ['GBP', undefined, undefined, 'Great Britain, United Kingdom'],
366
- },
243
+ { value: 'GBP', searchable: 'Great Britain, United Kingdom' },
367
244
  ]);
368
245
  });
369
246
 
@@ -372,73 +249,51 @@ describe('Money Input', () => {
372
249
  { value: 'GBP', searchable: 'Great Britain, United Kingdom' },
373
250
  { value: 'EUR', searchable: 'Europe' },
374
251
  ];
252
+ const CUSTOM_ACTION = 'CUSTOM_ACTION';
375
253
  component.setProps({
376
254
  currencies,
377
255
  onCustomAction: jest.fn(),
378
256
  customActionLabel: 'I am a label',
379
257
  });
380
258
  expect(displayedCurrencies()).toStrictEqual([
381
- {
382
- type: 'option',
383
- value: { value: 'GBP', searchable: 'Great Britain, United Kingdom' },
384
- filterMatchers: ['GBP', undefined, undefined, 'Great Britain, United Kingdom'],
385
- },
386
- {
387
- type: 'option',
388
- value: { value: 'EUR', searchable: 'Europe' },
389
- filterMatchers: ['EUR', undefined, undefined, 'Europe'],
390
- },
259
+ ...currencies,
260
+ { value: CUSTOM_ACTION, label: 'I am a label' },
391
261
  ]);
392
262
 
393
263
  searchCurrencies('Britain');
394
264
  expect(displayedCurrencies()).toStrictEqual([
395
- {
396
- type: 'option',
397
- value: { value: 'GBP', searchable: 'Great Britain, United Kingdom' },
398
- filterMatchers: ['GBP', undefined, undefined, 'Great Britain, United Kingdom'],
399
- },
265
+ { value: 'GBP', searchable: 'Great Britain, United Kingdom' },
266
+ { value: CUSTOM_ACTION, label: 'I am a label' },
400
267
  ]);
401
268
 
402
269
  searchCurrencies('Random search string');
403
- expect(displayedCurrencies()).toHaveLength(0);
404
- const footerNode = shallow(getFooter()()).find('div');
405
- expect(footerNode).not.toBeNull();
270
+ expect(displayedCurrencies()).toStrictEqual([
271
+ { value: CUSTOM_ACTION, label: 'I am a label' },
272
+ ]);
406
273
  });
407
274
 
408
275
  it('sorts labels to first', () => {
409
276
  searchCurrencies('au');
410
277
  expect(displayedCurrencies()).toStrictEqual([
411
278
  {
412
- type: 'option',
413
- value: {
414
- value: 'AUD',
415
- label: 'AUD',
416
- note: 'Australian dollar',
417
- currency: 'aud',
418
- },
419
- filterMatchers: ['AUD', 'AUD', 'Australian dollar', undefined],
279
+ value: 'AUD',
280
+ label: 'AUD',
281
+ note: 'Australian dollar',
282
+ currency: 'aud',
420
283
  },
421
284
  {
422
- type: 'option',
423
- value: {
424
- value: 'EUR',
425
- label: 'EUR',
426
- note: 'Euro',
427
- currency: 'eur',
428
- searchable: 'Spain, Germany, France, Austria, Estonia',
429
- },
430
- filterMatchers: ['EUR', 'EUR', 'Euro', 'Spain, Germany, France, Austria, Estonia'],
285
+ value: 'EUR',
286
+ label: 'EUR',
287
+ note: 'Euro',
288
+ currency: 'eur',
289
+ searchable: 'Spain, Germany, France, Austria, Estonia',
431
290
  },
432
291
  {
433
- type: 'option',
434
- value: {
435
- value: 'USD',
436
- label: 'USD',
437
- note: 'United States dollar',
438
- currency: 'usd',
439
- searchable: 'Hong Kong, Saudi Arabia',
440
- },
441
- filterMatchers: ['USD', 'USD', 'United States dollar', 'Hong Kong, Saudi Arabia'],
292
+ value: 'USD',
293
+ label: 'USD',
294
+ note: 'United States dollar',
295
+ currency: 'usd',
296
+ searchable: 'Hong Kong, Saudi Arabia',
442
297
  },
443
298
  ]);
444
299
  });
@@ -582,24 +437,18 @@ describe('Money Input', () => {
582
437
 
583
438
  it('uses the passed in search placeholder', () => {
584
439
  component.setProps({ searchPlaceholder: 'a placeholder' });
585
- expect(currencySelect().prop('filterPlaceholder')).toBe('a placeholder');
440
+ expect(currencySelect().prop('searchPlaceholder')).toBe('a placeholder');
586
441
  });
587
442
 
588
443
  it('clears the search value when selecting an option', () => {
589
- const onSearchChange = jest.fn();
590
- component.setProps({ onSearchChange });
591
444
  searchCurrencies('eur');
592
- expect(onSearchChange).toHaveBeenLastCalledWith({
593
- searchQuery: 'eur',
594
- filteredOptions: [props.currencies[1]],
595
- });
445
+ expect(currencySelect().prop('options')).toHaveLength(1);
446
+ expect(currencySelect().prop('searchValue')).toBe('eur');
596
447
 
597
448
  currencySelect().prop('onChange')(props.currencies[1]);
598
449
  component.update();
599
- expect(onSearchChange).toHaveBeenLastCalledWith({
600
- searchQuery: '',
601
- filteredOptions: [...props.currencies],
602
- });
450
+ expect(currencySelect().prop('options')).toHaveLength(7);
451
+ expect(currencySelect().prop('searchValue')).toBe('');
603
452
  });
604
453
 
605
454
  it('shows custom action last when onCustomAction prop is passed to MoneyInput', () => {
@@ -607,25 +456,21 @@ describe('Money Input', () => {
607
456
  { value: 'GBP', searchable: 'Great Britain, United Kingdom' },
608
457
  { value: 'EUR', searchable: 'Europe' },
609
458
  ];
610
- const onCustomActionMock = jest.fn();
611
459
  component.setProps({
612
460
  currencies,
613
- onCustomAction: onCustomActionMock,
461
+ onCustomAction: jest.fn(),
614
462
  customActionLabel: 'Label boy',
615
463
  });
616
464
 
617
- const options = displayedCurrencies();
618
-
619
- expect(options).toHaveLength(2);
620
- expect(options[0].value).toStrictEqual(currencies[0]);
621
- expect(options[1].value).toStrictEqual(currencies[1]);
622
-
623
- const footerNode = shallow(getFooter()()).find('div');
465
+ expect(displayedCurrencies()).toStrictEqual([
466
+ ...currencies,
467
+ { value: 'CUSTOM_ACTION', label: 'Label boy' },
468
+ ]);
624
469
 
625
- expect(footerNode.prop('role')).toBe('button');
626
- expect(onCustomActionMock).toHaveBeenCalledTimes(0);
627
- footerNode.simulate('click');
628
- expect(onCustomActionMock).toHaveBeenCalledTimes(1);
470
+ expect(displayedCurrencies()[displayedCurrencies().length - 1]).toStrictEqual({
471
+ value: 'CUSTOM_ACTION',
472
+ label: 'Label boy',
473
+ });
629
474
  });
630
475
 
631
476
  it('calls onCustomAction callback when custom action is selected', () => {
@@ -634,9 +479,7 @@ describe('Money Input', () => {
634
479
  expect(onCustomAction).not.toHaveBeenCalled();
635
480
  expect(props.onCurrencyChange).not.toHaveBeenCalled();
636
481
 
637
- const footerNode = shallow(getFooter()()).find('div');
638
- expect(onCustomAction).toHaveBeenCalledTimes(0);
639
- footerNode.simulate('click');
482
+ currencySelect().prop('onChange')({ value: 'CUSTOM_ACTION', label: '' });
640
483
  expect(onCustomAction).toHaveBeenCalledTimes(1);
641
484
  expect(props.onCurrencyChange).toHaveBeenCalledTimes(0);
642
485
  });
@@ -705,8 +548,7 @@ describe('Money Input', () => {
705
548
  filteredOptions: [getCurrencyByValue('EUR')],
706
549
  });
707
550
 
708
- const footerNode = shallow(getFooter()()).find('div');
709
- footerNode.simulate('click');
551
+ currencySelect().prop('onChange')({ value: 'CUSTOM_ACTION' });
710
552
  expect(onCustomAction).toHaveBeenCalledTimes(1);
711
553
  expect(onSearchChange).toHaveBeenLastCalledWith({
712
554
  searchQuery: '',
@@ -715,6 +557,33 @@ describe('Money Input', () => {
715
557
  });
716
558
  });
717
559
 
560
+ describe('when typing', () => {
561
+ let rtlComponent;
562
+ const { formatAmount } = jest.requireActual('./currencyFormatting');
563
+ beforeAll(() => {
564
+ numberFormatting.formatAmount = formatAmount;
565
+ });
566
+
567
+ beforeEach(() => {
568
+ rtlComponent = render(<MoneyInput {...props} amount={null} />);
569
+ jest.clearAllMocks();
570
+ });
571
+
572
+ it.each([
573
+ ['asd', ''],
574
+ ['1a2s3d', '123'],
575
+ ['±!@#$^*_+?><', ''],
576
+ ['1±!@#$^*,_+?><2', '1,2'],
577
+ ['12,3', '12,3'],
578
+ ['12.3', '12.3'],
579
+ ])("ignores the letters when typed '%s' and shows '%s'", (testValue, expectedValue) => {
580
+ const { container } = rtlComponent;
581
+ const input = container.querySelector('input');
582
+ userEvent.type(input, testValue);
583
+ expect(input).toHaveValue(expectedValue);
584
+ });
585
+ });
586
+
718
587
  describe('when passed selectProps', () => {
719
588
  beforeEach(() => {
720
589
  component = shallow(
@@ -730,7 +599,7 @@ describe('Money Input', () => {
730
599
  });
731
600
 
732
601
  it('renders Select component with expected props', () => {
733
- const select = component.find('SelectInput');
602
+ const select = component.find('Select');
734
603
 
735
604
  expect(select.prop('buttonProps')).toStrictEqual({
736
605
  'aria-label': 'mock-button-label',
@@ -1,6 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { within, userEvent } from '@storybook/testing-library';
3
- import { Lock } from '@transferwise/icons';
4
3
 
5
4
  import MoneyInput from '.';
6
5
 
@@ -42,41 +41,6 @@ const exampleCurrency = {
42
41
  currency: 'gbp',
43
42
  searchable: 'England, Scotland, Wales',
44
43
  },
45
- usd: {
46
- value: 'USD',
47
- label: 'USD',
48
- note: 'United States dollar',
49
- currency: 'usd',
50
- searchable: 'Hong Kong, Saudi Arabia',
51
- },
52
- hkd: {
53
- value: 'HKD',
54
- label: 'HKD',
55
- note: 'Hong Kong',
56
- currency: 'hkd',
57
- searchable: 'Hong Kong, Saudi Arabia',
58
- },
59
- aud: {
60
- value: 'AUD',
61
- label: 'AUD',
62
- note: 'Australia',
63
- currency: 'aud',
64
- searchable: 'Kenguru',
65
- },
66
- cny: {
67
- value: 'CNY',
68
- label: 'CNY',
69
- note: 'China',
70
- currency: 'cny',
71
- searchable: 'China',
72
- },
73
- jpy: {
74
- value: 'JPY',
75
- label: 'JPY',
76
- note: 'Japan',
77
- currency: 'jpy',
78
- searchable: 'Japan',
79
- },
80
44
  } as const;
81
45
 
82
46
  export const SingleCurrency: Story = {
@@ -89,28 +53,14 @@ export const SingleCurrency: Story = {
89
53
 
90
54
  export const MultipleCurrencies: Story = {
91
55
  args: {
92
- addon: <Lock />,
93
56
  currencies: [
94
57
  {
95
58
  header: 'Popular currencies',
96
59
  },
97
60
  exampleCurrency.eur,
98
61
  exampleCurrency.gbp,
99
- exampleCurrency.usd,
100
- exampleCurrency.hkd,
101
- { header: 'All currencies' },
102
- exampleCurrency.eur,
103
- exampleCurrency.gbp,
104
- exampleCurrency.usd,
105
- exampleCurrency.aud,
106
- exampleCurrency.jpy,
107
62
  ],
108
- customActionLabel: 'Custom message with custom action',
109
- onCustomAction: () => {
110
- console.log('Custom action');
111
- },
112
- selectedCurrency: exampleCurrency.usd,
113
- searchPlaceholder: 'Type a currency / country',
63
+ selectedCurrency: exampleCurrency.eur,
114
64
  },
115
65
  };
116
66
 
package/src/ssr.spec.js CHANGED
@@ -12,6 +12,7 @@ const excluded = new Set([
12
12
  'useSnackbar',
13
13
  'useDirection',
14
14
  'useLayout',
15
+ 'useScreenSize',
15
16
 
16
17
  // specific components
17
18
  'Provider',
@@ -2,7 +2,7 @@ import { within } from '@testing-library/react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
 
4
4
  import { Status } from '../common';
5
- import { render, screen, waitFor, waitForElementToBeRemoved } from '../test-utils';
5
+ import { mockMatchMedia, render, screen, waitFor, waitForElementToBeRemoved } from '../test-utils';
6
6
 
7
7
  import UploadInput, { UploadInputProps } from './UploadInput';
8
8
  import { TEST_IDS as UPLOAD_BUTTON_TEST_IDS } from './uploadButton/UploadButton';
@@ -10,6 +10,8 @@ import { TEST_IDS as UPLOAD_ITEM_TEST_IDS } from './uploadItem/UploadItem';
10
10
 
11
11
  const spiedDateObject = jest.spyOn(global, 'Date');
12
12
 
13
+ mockMatchMedia();
14
+
13
15
  describe('UploadInput', () => {
14
16
  const pngFile = new File(['foo'], 'foo.png', { type: 'image/png' });
15
17
  const jpgFile = new File(['foo'], 'foo.jpg', { type: 'image/jpeg' });