@transferwise/components 0.0.0-experimental-dad811d → 0.0.0-experimental-36cf7cb

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/build/index.esm.js +193 -327
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +164 -298
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +6 -82
  6. package/build/styles/decision/Decision.css +6 -82
  7. package/build/styles/main.css +6 -82
  8. package/build/types/body/Body.d.ts +1 -1
  9. package/build/types/card/Card.d.ts +0 -1
  10. package/build/types/card/Card.d.ts.map +1 -1
  11. package/build/types/common/Option/Option.d.ts +0 -1
  12. package/build/types/common/Option/Option.d.ts.map +1 -1
  13. package/build/types/common/commonProps.d.ts +1 -1
  14. package/build/types/common/commonProps.d.ts.map +1 -1
  15. package/build/types/common/panel/Panel.d.ts +1 -1
  16. package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -1
  17. package/build/types/dateInput/index.d.ts +2 -2
  18. package/build/types/dateInput/index.d.ts.map +1 -1
  19. package/build/types/dateLookup/DateLookup.d.ts +1 -0
  20. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  21. package/build/types/decision/Decision.d.ts +39 -52
  22. package/build/types/decision/Decision.d.ts.map +1 -1
  23. package/build/types/decision/index.d.ts +1 -2
  24. package/build/types/decision/index.d.ts.map +1 -1
  25. package/build/types/dimmer/Dimmer.d.ts +1 -1
  26. package/build/types/index.d.ts +2 -0
  27. package/build/types/index.d.ts.map +1 -1
  28. package/build/types/promoCard/PromoCard.d.ts +1 -2
  29. package/build/types/promoCard/PromoCard.d.ts.map +1 -1
  30. package/build/types/select/searchBox/SearchBox.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/src/card/Card.js +0 -3
  33. package/src/card/Card.story.js +2 -17
  34. package/src/common/Option/Option.spec.js +0 -7
  35. package/src/common/Option/Option.tsx +2 -9
  36. package/src/common/commonProps.ts +1 -1
  37. package/src/dateInput/index.ts +2 -3
  38. package/src/dateLookup/DateLookup.js +12 -1
  39. package/src/dateLookup/DateLookup.testingLibrary.spec.js +12 -1
  40. package/src/decision/Decision.css +6 -82
  41. package/src/decision/Decision.less +3 -41
  42. package/src/decision/Decision.spec.js +56 -61
  43. package/src/decision/{Decision.story.js → Decision.story.tsx} +5 -5
  44. package/src/decision/Decision.tsx +133 -0
  45. package/src/decision/index.ts +1 -0
  46. package/src/index.ts +2 -0
  47. package/src/main.css +6 -82
  48. package/src/promoCard/PromoCard.tsx +1 -2
  49. package/src/tile/Tile.js +1 -1
  50. package/build/types/decision/decisionEnums.d.ts +0 -9
  51. package/build/types/decision/decisionEnums.d.ts.map +0 -1
  52. package/build/types/sizeSwapper/SizeSwapper.d.ts +0 -3
  53. package/build/types/sizeSwapper/SizeSwapper.d.ts.map +0 -1
  54. package/build/types/sizeSwapper/index.d.ts +0 -2
  55. package/build/types/sizeSwapper/index.d.ts.map +0 -1
  56. package/src/decision/Decision.js +0 -148
  57. package/src/decision/decisionEnums.ts +0 -11
  58. package/src/decision/index.js +0 -2
  59. package/src/sizeSwapper/SizeSwapper.js +0 -69
  60. package/src/sizeSwapper/SizeSwapper.spec.js +0 -100
  61. package/src/sizeSwapper/SizeSwapper.story.js +0 -34
  62. package/src/sizeSwapper/index.js +0 -1
package/src/card/Card.js CHANGED
@@ -18,7 +18,6 @@ const Card = forwardRef((props, reference) => {
18
18
  children,
19
19
  onClick,
20
20
  icon,
21
- badgeContentIcon,
22
21
  id,
23
22
  className,
24
23
  ...rest
@@ -41,7 +40,6 @@ const Card = forwardRef((props, reference) => {
41
40
  as={children ? 'button' : 'div'}
42
41
  className={classNames('np-card__button')}
43
42
  media={icon}
44
- badgeContentIcon={badgeContentIcon}
45
43
  title={title}
46
44
  content={details}
47
45
  showMediaAtAllSizes
@@ -72,7 +70,6 @@ Card.propTypes = {
72
70
  details: PropTypes.node.isRequired,
73
71
  onClick: requiredIf(PropTypes.func, hasChildren),
74
72
  icon: PropTypes.node,
75
- badgeContentIcon: PropTypes.node,
76
73
  children: PropTypes.node,
77
74
  id: PropTypes.string,
78
75
  className: PropTypes.string,
@@ -2,8 +2,6 @@ import { select, text } from '@storybook/addon-knobs';
2
2
  import { FastFlag as FastFlagIcon } from '@transferwise/icons';
3
3
  import { useState } from 'react';
4
4
 
5
- import { StatusIcon, Sentiment } from '..';
6
-
7
5
  import Card from '.';
8
6
 
9
7
  export default {
@@ -20,11 +18,10 @@ const Template = (props) => {
20
18
  return (
21
19
  <Card
22
20
  as={elementType}
23
- title={props.title || title}
21
+ title={title}
24
22
  details={details}
25
23
  isExpanded={props.isExpanded}
26
24
  icon={props.icon}
27
- badgeContentIcon={props.badgeContentIcon}
28
25
  onClick={props.onClick}
29
26
  >
30
27
  {content}
@@ -51,7 +48,6 @@ export const Multiple = () => {
51
48
  return (
52
49
  <>
53
50
  <Template
54
- title="Expanded Card"
55
51
  icon={<FastFlagIcon />}
56
52
  isExpanded={expandedCardIndex === 0}
57
53
  onClick={() => handleOnCardClick(0)}
@@ -61,18 +57,7 @@ export const Multiple = () => {
61
57
  isExpanded={expandedCardIndex === 1}
62
58
  onClick={() => handleOnCardClick(1)}
63
59
  />
64
- <Template
65
- icon={<FastFlagIcon />}
66
- badgeContentIcon={<StatusIcon size="sm" sentiment={Sentiment.WARNING} />}
67
- title="A card with badgeContentIcon"
68
- isExpanded={expandedCardIndex === 2}
69
- onClick={() => handleOnCardClick(2)}
70
- />
71
- <Template
72
- title="A card without media"
73
- isExpanded={expandedCardIndex === 3}
74
- onClick={() => handleOnCardClick(3)}
75
- />
60
+ <Template isExpanded={expandedCardIndex === 2} onClick={() => handleOnCardClick(2)} />
76
61
  </>
77
62
  );
78
63
  };
@@ -68,13 +68,6 @@ describe('Option', () => {
68
68
  expect(circleContentIsElement(<Icon />)).toBe(true);
69
69
  });
70
70
 
71
- it('has passed badgeContentIcon to render a badge with content icon', () => {
72
- const Icon = () => <svg />;
73
- component.setProps({ media: <Icon />, badgeContentIcon: <Icon /> });
74
-
75
- expect(component.find('Badge').exists()).toBe(true);
76
- });
77
-
78
71
  it('does not render the circle content with circle-inverse class when inverseMediaCircle is set to false', () => {
79
72
  expect(circleContentHasInverseClass()).toBe(true);
80
73
  component.setProps({ inverseMediaCircle: false });
@@ -1,15 +1,13 @@
1
1
  import classNames from 'classnames';
2
2
  import { MouseEvent, forwardRef, HTMLAttributes, ReactNode, ElementType } from 'react';
3
3
 
4
- import Avatar from '../../avatar';
5
- import Badge from '../../badge';
6
4
  import Body from '../../body';
7
5
  import { LinkProps } from '../commonProps';
6
+ import { Typography } from '../propsValues/typography';
8
7
 
9
8
  export interface BaseOptionProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'content'> {
10
9
  'aria-label'?: string;
11
10
  media?: ReactNode;
12
- badgeContentIcon?: ReactNode;
13
11
  name?: string;
14
12
  htmlFor?: string;
15
13
  title: ReactNode;
@@ -39,7 +37,6 @@ const Option = forwardRef<ReferenceType, OptionProps>(
39
37
  (
40
38
  {
41
39
  media = '',
42
- badgeContentIcon = '',
43
40
  title,
44
41
  content,
45
42
  as: component,
@@ -74,11 +71,7 @@ const Option = forwardRef<ReferenceType, OptionProps>(
74
71
  <div className="media">
75
72
  {media && (
76
73
  <div className="media-left">
77
- {badgeContentIcon ? (
78
- <Badge badge={badgeContentIcon}>
79
- <Avatar type="icon">{media}</Avatar>
80
- </Badge>
81
- ) : showMediaCircle ? (
74
+ {showMediaCircle ? (
82
75
  <div
83
76
  className={classNames('circle circle-sm text-primary', {
84
77
  'circle-inverse': inverseMediaCircle,
@@ -14,7 +14,7 @@ export type AriaLabelProperty = {
14
14
 
15
15
  export type LinkProps = {
16
16
  href: string;
17
- target?: '_blank' | '_self' | '_parent' | '_top';
17
+ target?: React.HTMLAttributeAnchorTarget;
18
18
  onClick?: React.MouseEventHandler<HTMLElement>;
19
19
  };
20
20
 
@@ -1,3 +1,2 @@
1
- import DateInput from './DateInput';
2
-
3
- export default DateInput;
1
+ export { default } from './DateInput';
2
+ export type { DateInputProps } from './DateInput';
@@ -240,10 +240,20 @@ class DateLookup extends PureComponent {
240
240
  render() {
241
241
  const { selectedDate, open } = this.state;
242
242
 
243
- const { size, placeholder, label, monthFormat, disabled, clearable, value } = this.props;
243
+ const {
244
+ size,
245
+ placeholder,
246
+ label,
247
+ 'aria-labelledby': ariaLabelledBy,
248
+ monthFormat,
249
+ disabled,
250
+ clearable,
251
+ value,
252
+ } = this.props;
244
253
  return (
245
254
  <div // eslint-disable-line jsx-a11y/no-static-element-interactions
246
255
  ref={this.element}
256
+ aria-labelledby={ariaLabelledBy}
247
257
  className="input-group"
248
258
  onKeyDown={this.handleKeyDown}
249
259
  >
@@ -273,6 +283,7 @@ DateLookup.propTypes = {
273
283
  size: PropTypes.oneOf(['sm', 'md', 'lg']),
274
284
  placeholder: PropTypes.string,
275
285
  label: PropTypes.string,
286
+ 'aria-labelledby': PropTypes.string,
276
287
  monthFormat: PropTypes.oneOf(['long', 'short']),
277
288
  disabled: PropTypes.bool,
278
289
  onChange: PropTypes.func.isRequired,
@@ -32,12 +32,19 @@ describe('DateLookup (events)', () => {
32
32
  size: 'lg',
33
33
  placeholder: 'Asd..',
34
34
  label: 'label',
35
+ 'aria-labelledby': 'prioritized-label',
35
36
  onChange: jest.fn(),
36
37
  onClick: jest.fn(),
37
38
  disabled: false,
38
39
  clearable: false,
39
40
  };
40
- ({ container } = render(<DateLookup {...props} />));
41
+ ({ container } = render(
42
+ <>
43
+ {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
44
+ <label id="prioritized-label">Prioritized label</label>
45
+ <DateLookup {...props} />
46
+ </>,
47
+ ));
41
48
  });
42
49
 
43
50
  afterEach(() => {
@@ -114,6 +121,10 @@ describe('DateLookup (events)', () => {
114
121
  expect(screen.getByRole('button', { name: /selected day/i })).toBeInTheDocument();
115
122
  });
116
123
 
124
+ it('supports custom `aria-labelledby` attribute', () => {
125
+ expect(screen.getByLabelText('Prioritized label')).toHaveClass('input-group');
126
+ });
127
+
117
128
  describe('when is clearable', () => {
118
129
  beforeEach(() => {
119
130
  props = { value: date, onChange: jest.fn(), clearable: true };
@@ -1,93 +1,17 @@
1
1
  .np-decision .decision {
2
2
  display: flex;
3
3
  }
4
- .np-decision__tile--small + .np-decision__tile--small {
5
- margin-left: 16px;
6
- margin-left: var(--size-16);
7
- }
8
- [dir="rtl"] .np-decision__tile--small + .np-decision__tile--small {
9
- margin-right: 16px;
10
- margin-right: var(--size-16);
11
- margin-left: 0;
12
- margin-left: initial;
13
- }
14
- .np-decision.np-decision--grid .np-decision__tile--small {
15
- margin-left: 0;
16
- margin-bottom: 16px !important;
17
- margin-bottom: var(--size-16) !important;
18
- }
19
- [dir="rtl"] .np-decision.np-decision--grid .np-decision__tile--small {
20
- margin-right: 0;
21
- margin-left: 0;
22
- margin-left: initial;
23
- }
24
- .np-decision.np-decision--grid .np-decision__tile--small:not(:last-of-type) {
25
- margin-right: 16px;
26
- margin-right: var(--size-16);
27
- }
28
- [dir="rtl"] .np-decision.np-decision--grid .np-decision__tile--small:not(:last-of-type) {
29
- margin-left: 16px;
30
- margin-left: var(--size-16);
31
- margin-right: 0;
32
- margin-right: initial;
33
- }
34
- .np-decision__tile + .np-decision__tile {
35
- margin-left: 24px;
36
- margin-left: var(--size-24);
37
- }
38
- [dir="rtl"] .np-decision__tile + .np-decision__tile {
39
- margin-right: 24px;
40
- margin-right: var(--size-24);
41
- margin-left: 0;
42
- margin-left: initial;
43
- }
44
- .np-decision .np-text-title-subsection {
45
- margin-bottom: 0;
46
- }
47
4
  .np-decision__tile--small .np-text-title-subsection {
48
5
  font-size: 1rem;
49
6
  font-size: var(--font-size-16);
50
7
  line-height: 1.2;
51
8
  line-height: var(--line-height-title);
52
- margin-bottom: 0;
53
- }
54
- .np-decision.np-decision--grid .np-decision__tile {
55
- margin-left: 0;
56
- margin-bottom: 24px !important;
57
- margin-bottom: var(--size-24) !important;
58
- }
59
- [dir="rtl"] .np-decision.np-decision--grid .np-decision__tile {
60
- margin-right: 0;
61
- margin-left: 0;
62
- margin-left: initial;
63
- }
64
- .np-decision.np-decision--grid .np-decision__tile:not(:last-of-type) {
65
- margin-right: 24px;
66
- margin-right: var(--size-24);
67
- }
68
- [dir="rtl"] .np-decision.np-decision--grid .np-decision__tile:not(:last-of-type) {
69
- margin-left: 24px;
70
- margin-left: var(--size-24);
71
- margin-right: 0;
72
- margin-right: initial;
73
- }
74
- .np-decision.np-decision--grid .np-size-swapper {
75
- margin-right: calc(0 - 24px);
76
- margin-right: calc(0 - var(--size-24));
77
- }
78
- [dir="rtl"] .np-decision.np-decision--grid .np-size-swapper {
79
- margin-left: calc(0 - 24px);
80
- margin-left: calc(0 - var(--size-24));
81
- margin-right: 0;
82
- margin-right: initial;
83
9
  }
84
- .np-decision.np-decision--grid.np-decision--small .np-size-swapper {
85
- margin-right: calc(0 - 16px);
86
- margin-right: calc(0 - var(--size-16));
10
+ .np-decision:not(.flex-column) {
11
+ gap: 24px;
12
+ gap: var(--size-24);
87
13
  }
88
- [dir="rtl"] .np-decision.np-decision--grid.np-decision--small .np-size-swapper {
89
- margin-left: calc(0 - 16px);
90
- margin-left: calc(0 - var(--size-16));
91
- margin-right: 0;
92
- margin-right: initial;
14
+ .np-decision:not(.flex-column).np-decision--small {
15
+ gap: 16px;
16
+ gap: var(--size-16);
93
17
  }
@@ -5,56 +5,18 @@
5
5
  display: flex;
6
6
  }
7
7
 
8
- &__tile--small + &__tile--small {
9
- .margin(left, var(--size-16));
10
- }
11
-
12
- &.np-decision--grid &__tile--small {
13
- .margin(left, 0);
14
-
15
- margin-bottom: var(--size-16) !important;
16
-
17
- &:not(:last-of-type) {
18
- .margin(right, var(--size-16));
19
- }
20
- }
21
-
22
- &__tile + &__tile {
23
- .margin(left, var(--size-24));
24
- }
25
-
26
- .np-text-title-subsection {
27
- margin-bottom: 0;
28
- }
29
-
30
8
  &__tile--small {
31
9
  .np-text-title-subsection {
32
10
  font-size: var(--font-size-16);
33
11
  line-height: var(--line-height-title);
34
- margin-bottom: 0;
35
12
  }
36
13
  }
37
14
 
38
- &.np-decision--grid &__tile {
39
-
40
- .margin(left, 0);
41
-
42
- margin-bottom: var(--size-24) !important;
43
-
44
- &:not(:last-of-type) {
45
- .margin(right, var(--size-24));
46
- }
47
- }
48
-
49
- &.np-decision--grid {
50
- .np-size-swapper {
51
- .margin(right, calc(0 - var(--size-24)));
52
- }
15
+ &:not(.flex-column) {
16
+ gap: var(--size-24);
53
17
 
54
18
  &.np-decision--small {
55
- .np-size-swapper {
56
- .margin(right, calc(0 - var(--size-16)));
57
- }
19
+ gap: var(--size-16);
58
20
  }
59
21
  }
60
22
  }
@@ -3,16 +3,16 @@ import '@testing-library/jest-dom';
3
3
 
4
4
  import Avatar from '../avatar';
5
5
  import { Breakpoint, Size } from '../common';
6
- import { render, fireEvent } from '../test-utils';
6
+ import { mockMatchMedia } from '../mocks';
7
+ import { render, fireEvent, screen } from '../test-utils';
7
8
 
8
- import { Presentation, Type } from './decisionEnums';
9
-
10
- import Decision from '.';
9
+ import Decision, { DecisionPresentation, DecisionType } from '.';
11
10
 
12
11
  jest.mock('lodash.throttle', () => jest.fn((fn) => fn));
12
+ mockMatchMedia(jest);
13
13
 
14
14
  describe('Decision', () => {
15
- const props = {
15
+ const commonProps = {
16
16
  options: [
17
17
  {
18
18
  media: {
@@ -25,112 +25,107 @@ describe('Decision', () => {
25
25
  onClick: jest.fn(),
26
26
  },
27
27
  ],
28
- presentation: Presentation.LIST_BLOCK,
29
- type: Type.NAVIGATION,
28
+ presentation: DecisionPresentation.LIST_BLOCK,
29
+ type: DecisionType.NAVIGATION,
30
30
  };
31
31
 
32
+ const initialInnerWidth = window.innerWidth;
32
33
  const resetClientWidth = (width) => {
33
- Object.defineProperty(HTMLElement.prototype, 'clientWidth', {
34
- configurable: true,
35
- value: width,
36
- });
34
+ window.innerWidth = width;
37
35
  };
38
36
 
39
37
  afterAll(() => {
40
- const originalClientWidth = Object.getOwnPropertyDescriptor(
41
- HTMLElement.prototype,
42
- 'clientWidth',
43
- );
44
-
45
- Object.defineProperty(HTMLElement.prototype, 'clientWidth', originalClientWidth);
38
+ window.innerWidth = initialInnerWidth;
46
39
  });
47
40
 
48
- let container;
49
41
  beforeEach(() => {
50
42
  resetClientWidth(Breakpoint.EXTRA_SMALL - 1);
51
43
  });
52
44
 
53
- describe(`when presentation is ${Presentation.LIST_BLOCK}`, () => {
54
- beforeEach(() => {
55
- ({ container } = render(<Decision {...props} />));
56
- });
45
+ describe(`when presentation is ${DecisionPresentation.LIST_BLOCK}`, () => {
46
+ const props = { ...commonProps };
57
47
 
58
48
  it('renders only Navigation Option before first breakpoint', () => {
59
- expect(getNavigationOption()).toBeInTheDocument();
60
- expect(getTile()).not.toBeInTheDocument();
49
+ const { container } = render(<Decision {...props} />);
50
+
51
+ expect(getNavigationOption(container)).toBeInTheDocument();
52
+ expect(getTile(container)).not.toBeInTheDocument();
61
53
  });
62
54
 
63
55
  it('renders only Tile after first breakpoint', () => {
64
56
  resetClientWidth(Breakpoint.SMALL);
65
- fireEvent(window, new Event('resize'));
57
+ const { container } = render(<Decision {...props} />);
66
58
 
67
- expect(getNavigationOption()).not.toBeInTheDocument();
68
- expect(getTile()).toBeInTheDocument();
69
- expect(getTile()).not.toHaveClass('np-tile--small');
59
+ expect(getNavigationOption(container)).not.toBeInTheDocument();
60
+ expect(getTile(container)).toBeInTheDocument();
61
+ expect(getTile(container)).not.toHaveClass('np-tile--small');
70
62
  });
71
63
  });
72
64
 
73
- describe(`when presentation is ${Presentation.LIST_BLOCK_GRID}`, () => {
74
- beforeEach(() => {
75
- ({ container } = render(<Decision {...props} presentation={Presentation.LIST_BLOCK_GRID} />));
76
- });
65
+ describe(`when presentation is ${DecisionPresentation.LIST_BLOCK_GRID}`, () => {
66
+ const props = { ...commonProps, presentation: DecisionPresentation.LIST_BLOCK_GRID };
77
67
 
78
68
  it('renders only Navigation Option before first breakpoint', () => {
79
- expect(getNavigationOption()).toBeInTheDocument();
80
- expect(getTile()).not.toBeInTheDocument();
69
+ const { container } = render(<Decision {...props} />);
70
+
71
+ expect(getNavigationOption(container)).toBeInTheDocument();
72
+ expect(getTile(container)).not.toBeInTheDocument();
81
73
  });
82
74
 
83
75
  it('renders only Tile after first breakpoint', () => {
84
76
  resetClientWidth(Breakpoint.SMALL);
85
- fireEvent(window, new Event('resize'));
77
+ const { container } = render(<Decision {...props} />);
86
78
 
87
- expect(getNavigationOption()).not.toBeInTheDocument();
88
- expect(getTile()).toBeInTheDocument();
89
- expect(getTile()).not.toHaveClass('np-tile--small');
79
+ expect(getNavigationOption(container)).not.toBeInTheDocument();
80
+ expect(getTile(container)).toBeInTheDocument();
81
+ expect(getTile(container)).not.toHaveClass('np-tile--small');
90
82
  });
91
83
 
92
84
  it('renders container as a grid', () => {
93
85
  resetClientWidth(Breakpoint.SMALL);
94
- fireEvent(window, new Event('resize'));
86
+ const { container } = render(<Decision {...props} />);
95
87
 
96
- expect(container.querySelector('.np-decision')).toHaveClass('np-decision--grid');
97
- expect(container.querySelector('.np-size-swapper')).toHaveClass('flex-wrap');
88
+ const decisionElement = container.querySelector('.np-decision');
89
+ expect(decisionElement).toHaveClass('np-decision--grid');
90
+ expect(decisionElement).toHaveClass('flex-wrap');
98
91
  });
99
92
  });
100
93
 
101
- describe(`when presentation is ${Presentation.LIST_BLOCK} and size is Small`, () => {
102
- beforeEach(() => {
103
- ({ container } = render(
104
- <Decision {...props} presentation={Presentation.LIST_BLOCK} size={Size.SMALL} />,
105
- ));
106
- });
94
+ describe(`when presentation is ${DecisionPresentation.LIST_BLOCK} and size is Small`, () => {
95
+ const props = {
96
+ ...commonProps,
97
+ presentation: DecisionPresentation.LIST_BLOCK,
98
+ size: Size.SMALL,
99
+ };
107
100
 
108
101
  it('renders only Navigation Option before breakpoint', () => {
109
- expect(getNavigationOption()).toBeInTheDocument();
110
- expect(getTile()).not.toBeInTheDocument();
102
+ const { container } = render(<Decision {...props} />);
103
+
104
+ expect(getNavigationOption(container)).toBeInTheDocument();
105
+ expect(getTile(container)).not.toBeInTheDocument();
111
106
  });
112
107
 
113
108
  it('renders Small Tile after breakpoint', () => {
114
109
  resetClientWidth(Breakpoint.EXTRA_SMALL);
115
- fireEvent(window, new Event('resize'));
110
+ const { container } = render(<Decision {...props} />);
116
111
 
117
- expect(getNavigationOption()).not.toBeInTheDocument();
118
- expect(getTile()).toBeInTheDocument();
119
- expect(getTile()).toHaveClass('np-tile--small');
112
+ expect(getNavigationOption(container)).not.toBeInTheDocument();
113
+ expect(getTile(container)).toBeInTheDocument();
114
+ expect(getTile(container)).toHaveClass('np-tile--small');
120
115
  });
121
116
  });
122
117
 
123
- describe(`when presentation is ${Presentation.LIST}`, () => {
124
- beforeEach(() => {
125
- ({ container } = render(<Decision {...props} presentation={Presentation.LIST} />));
126
- });
118
+ describe(`when presentation is ${DecisionPresentation.LIST}`, () => {
119
+ const props = { ...commonProps, presentation: DecisionPresentation.LIST };
127
120
 
128
121
  it('renders Navigation Option before breakpoint', () => {
129
- expect(getNavigationOption()).toBeInTheDocument();
130
- expect(getTile()).not.toBeInTheDocument();
122
+ const { container } = render(<Decision {...props} />);
123
+
124
+ expect(getNavigationOption(container)).toBeInTheDocument();
125
+ expect(getTile(container)).not.toBeInTheDocument();
131
126
  });
132
127
  });
133
128
 
134
- const getNavigationOption = () => container.querySelector('.np-navigation-option');
135
- const getTile = () => container.querySelector('.np-tile');
129
+ const getNavigationOption = (container) => container.querySelector('.np-navigation-option');
130
+ const getTile = (container) => container.querySelector('.np-tile');
136
131
  });
@@ -21,7 +21,7 @@ export const Basic = () => {
21
21
  const disabled = boolean('disabled', false);
22
22
  const showMediaCircleInList = boolean('showMediaCircleInList', true);
23
23
  const isContainerAligned = boolean('isContainerAligned', false);
24
- const size = select('size', [Size.MEDIUM, Size.SMALL]);
24
+ const size = select('size', [Size.MEDIUM, Size.SMALL], Size.MEDIUM);
25
25
 
26
26
  return (
27
27
  <>
@@ -33,7 +33,7 @@ export const Basic = () => {
33
33
  href: '#href1',
34
34
  disabled,
35
35
  media: {
36
- block: <Illustration name="globe" alt="" disableMargin />,
36
+ block: <Illustration name="globe" alt="" disablePadding />,
37
37
  list: (
38
38
  <Avatar size="md" type="initials">
39
39
  HM
@@ -49,7 +49,7 @@ export const Basic = () => {
49
49
  disabled,
50
50
  href: '#href2',
51
51
  media: {
52
- block: <Illustration name="confetti" alt="" disableMargin />,
52
+ block: <Illustration name="confetti" alt="" disablePadding />,
53
53
  list: (
54
54
  <Avatar size="md" type="initials">
55
55
  HM
@@ -61,7 +61,7 @@ export const Basic = () => {
61
61
  {
62
62
  description: "I'm disabled and don't require an onClick or href.",
63
63
  media: {
64
- block: <Illustration name="briefcase" alt="" disableMargin />,
64
+ block: <Illustration name="briefcase" alt="" disablePadding />,
65
65
  list: (
66
66
  <img
67
67
  src="https://wise.com/public-resources/assets/illustrations/business_account_web_small.svg"
@@ -91,7 +91,7 @@ export const grid = () => {
91
91
  DecisionPresentation.LIST_BLOCK_GRID,
92
92
  );
93
93
  const disabled = boolean('disabled', false);
94
- const size = select('size', [Size.MEDIUM, Size.SMALL]);
94
+ const size = select('size', [Size.MEDIUM, Size.SMALL], Size.MEDIUM);
95
95
 
96
96
  return (
97
97
  <>