@transferwise/components 0.0.0-experimental-a8f3db2 → 0.0.0-experimental-8abc58f

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 (71) hide show
  1. package/build/main.css +11 -15
  2. package/build/styles/main.css +11 -15
  3. package/build/styles/switch/Switch.css +22 -41
  4. package/build/styles/switchOption/SwitchOption.css +4 -0
  5. package/build/switch/Switch.js +7 -18
  6. package/build/switch/Switch.js.map +1 -1
  7. package/build/switch/Switch.mjs +8 -19
  8. package/build/switch/Switch.mjs.map +1 -1
  9. package/build/switchOption/SwitchOption.js +1 -0
  10. package/build/switchOption/SwitchOption.js.map +1 -1
  11. package/build/switchOption/SwitchOption.mjs +1 -0
  12. package/build/switchOption/SwitchOption.mjs.map +1 -1
  13. package/build/types/switch/Switch.d.ts.map +1 -1
  14. package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
  15. package/package.json +1 -1
  16. package/src/accordion/Accordion.story.tsx +31 -21
  17. package/src/avatarView/AvatarView.story.tsx +1 -6
  18. package/src/carousel/Carousel.story.tsx +1 -0
  19. package/src/common/bottomSheet/BottomSheet.story.tsx +5 -4
  20. package/src/common/circle/Circle.story.tsx +1 -0
  21. package/src/dateLookup/DateLookup.story.tsx +1 -0
  22. package/src/decision/Decision.story.tsx +1 -0
  23. package/src/definitionList/DefinitionList.story.tsx +1 -0
  24. package/src/dimmer/Dimmer.story.tsx +1 -0
  25. package/src/display/Display.story.tsx +1 -0
  26. package/src/drawer/Drawer.story.tsx +1 -0
  27. package/src/dropFade/DropFade.story.tsx +1 -0
  28. package/src/flowNavigation/FlowNavigation.story.tsx +1 -0
  29. package/src/header/Header.story.tsx +1 -0
  30. package/src/iconButton/IconButton.story.tsx +1 -0
  31. package/src/image/Image.story.tsx +1 -0
  32. package/src/info/Info.story.tsx +1 -0
  33. package/src/inlineAlert/InlineAlert.story.tsx +1 -0
  34. package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +1 -0
  35. package/src/inputs/InputGroup.story.tsx +1 -0
  36. package/src/inputs/SearchInput.story.tsx +1 -0
  37. package/src/legacylistItem/LegacyListItem.tests.story.tsx +1 -0
  38. package/src/link/Link.story.tsx +1 -0
  39. package/src/main.css +11 -15
  40. package/src/main.less +1 -0
  41. package/src/modal/Modal.story.tsx +11 -6
  42. package/src/money/Money.story.tsx +1 -0
  43. package/src/navigationOptionsList/NavigationOptionsList.story.tsx +1 -0
  44. package/src/nudge/Nudge.story.tsx +1 -0
  45. package/src/overlayHeader/OverlayHeader.story.tsx +1 -0
  46. package/src/progress/Progress.story.tsx +1 -0
  47. package/src/provider/Provider.story.tsx +1 -0
  48. package/src/radio/Radio.story.tsx +1 -0
  49. package/src/radioGroup/RadioGroup.story.tsx +1 -0
  50. package/src/radioOption/RadioOption.story.tsx +1 -0
  51. package/src/section/Section.story.tsx +1 -0
  52. package/src/segmentedControl/SegmentedControl.story.tsx +1 -0
  53. package/src/select/Select.story.tsx +1 -0
  54. package/src/slidingPanel/SlidingPanel.story.tsx +1 -0
  55. package/src/snackbar/Snackbar.story.tsx +1 -0
  56. package/src/summary/Summary.story.tsx +1 -0
  57. package/src/switch/Switch.css +22 -41
  58. package/src/switch/Switch.less +6 -12
  59. package/src/switch/Switch.spec.tsx +11 -9
  60. package/src/switch/Switch.story.tsx +158 -33
  61. package/src/switch/Switch.tsx +6 -15
  62. package/src/switchOption/SwitchOption.css +4 -0
  63. package/src/switchOption/SwitchOption.less +8 -0
  64. package/src/switchOption/SwitchOption.spec.tsx +4 -5
  65. package/src/switchOption/SwitchOption.story.tsx +42 -38
  66. package/src/switchOption/SwitchOption.tsx +1 -0
  67. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +1 -0
  68. package/src/tile/Tile.story.tsx +1 -0
  69. package/src/title/Title.story.tsx +1 -0
  70. package/src/typeahead/Typeahead.story.tsx +1 -0
  71. package/src/switch/__snapshots__/Switch.spec.tsx.snap +0 -44
@@ -8,6 +8,7 @@ import DropFade from './DropFade';
8
8
  export default {
9
9
  title: 'Dialogs/DropFade',
10
10
  component: DropFade,
11
+ tags: ['autodocs'],
11
12
  };
12
13
 
13
14
  export const Basic = () => {
@@ -16,6 +16,7 @@ import Sticky from '../sticky';
16
16
  export default {
17
17
  component: FlowNavigation,
18
18
  title: 'Navigation/FlowNavigation',
19
+ tags: ['autodocs'],
19
20
  };
20
21
 
21
22
  export const Variants = () => {
@@ -3,6 +3,7 @@ import Header from './Header';
3
3
  export default {
4
4
  component: Header,
5
5
  title: 'Typography/Header',
6
+ tags: ['autodocs'],
6
7
  };
7
8
 
8
9
  export const Basic = () => {
@@ -7,6 +7,7 @@ import Body from '../body';
7
7
 
8
8
  export default {
9
9
  title: 'Actions/IconButton',
10
+ tags: ['autodocs'],
10
11
  } satisfies Meta<typeof IconButton>;
11
12
 
12
13
  type Story = StoryObj<typeof IconButton>;
@@ -6,6 +6,7 @@ import Image from './Image';
6
6
  export default {
7
7
  component: Image,
8
8
  title: 'Content/Image',
9
+ tags: ['autodocs'],
9
10
  };
10
11
 
11
12
  export const Basic = () => {
@@ -13,6 +13,7 @@ const meta = {
13
13
  title: 'Fast transfer hint',
14
14
  content: lorem10,
15
15
  },
16
+ tags: ['autodocs'],
16
17
  render: (args) => (
17
18
  <p>
18
19
  <span>Fast transfer</span> <Info {...args} />
@@ -7,6 +7,7 @@ import Link from '../link';
7
7
  export default {
8
8
  component: InlineAlert,
9
9
  title: 'Forms/InlineAlert',
10
+ tags: ['autodocs'],
10
11
  } as Meta<InlineAlertProps>;
11
12
 
12
13
  export const Basic = () => {
@@ -16,6 +16,7 @@ const meta: Meta<typeof InputWithDisplayFormat> = {
16
16
  </Field>
17
17
  );
18
18
  },
19
+ tags: ['autodocs'],
19
20
  args: {
20
21
  onFocus: fn(),
21
22
  onBlur: fn(),
@@ -11,6 +11,7 @@ import { InputGroup } from './InputGroup';
11
11
  export default {
12
12
  component: InputGroup,
13
13
  title: 'Forms/InputGroup',
14
+ tags: ['autodocs'],
14
15
  } satisfies Meta<typeof InputGroup>;
15
16
 
16
17
  type Story = StoryObj<typeof InputGroup>;
@@ -9,6 +9,7 @@ import { SearchInput } from './SearchInput';
9
9
  export default {
10
10
  component: SearchInput,
11
11
  title: 'Forms/SearchInput',
12
+ tags: ['autodocs'],
12
13
  } satisfies Meta<typeof SearchInput>;
13
14
 
14
15
  type Story = StoryObj<typeof SearchInput>;
@@ -6,6 +6,7 @@ import LegacyListItem, { List, type LegacyListItemProps } from '.';
6
6
  export default {
7
7
  component: LegacyListItem,
8
8
  title: 'Other/LegacyListItem/tests',
9
+ tags: ['autodocs'],
9
10
  };
10
11
 
11
12
  export const LongText = () => {
@@ -7,6 +7,7 @@ import Link from '.';
7
7
  export default {
8
8
  component: Link,
9
9
  title: 'Typography/Link',
10
+ tags: ['autodocs'],
10
11
  };
11
12
 
12
13
  export const Basic = () => {
package/src/main.css CHANGED
@@ -5149,6 +5149,8 @@ html:not([dir="rtl"]) .np-navigation-option {
5149
5149
  margin-top: var(--size-24);
5150
5150
  }
5151
5151
  .np-switch {
5152
+ all: unset;
5153
+ box-sizing: border-box;
5152
5154
  display: inline-flex;
5153
5155
  overflow: hidden;
5154
5156
  width: 50px;
@@ -5157,6 +5159,7 @@ html:not([dir="rtl"]) .np-navigation-option {
5157
5159
  -webkit-user-select: none;
5158
5160
  -moz-user-select: none;
5159
5161
  user-select: none;
5162
+ cursor: pointer;
5160
5163
  }
5161
5164
  .np-switch:focus {
5162
5165
  outline: none;
@@ -5189,21 +5192,10 @@ html:not([dir="rtl"]) .np-navigation-option {
5189
5192
  [dir="rtl"] .np-switch--checked .np-switch--thumb {
5190
5193
  transform: translateX(-20px) ;
5191
5194
  }
5192
- .np-switch input {
5193
- position: absolute;
5194
- left: -100%;
5195
- display: none;
5196
- width: 0;
5197
- height: 0;
5198
- opacity: 0;
5199
- }
5200
- [dir="rtl"] .np-switch input {
5201
- right: -100%;
5202
- left: auto;
5203
- left: initial;
5204
- }
5205
- .np-switch:not([aria-disabled]) {
5206
- cursor: pointer;
5195
+ .np-switch.disabled {
5196
+ filter: grayscale(1);
5197
+ opacity: 0.45;
5198
+ cursor: not-allowed !important;
5207
5199
  }
5208
5200
  .np-theme-personal .np-switch {
5209
5201
  padding: 1px 2px;
@@ -5219,6 +5211,10 @@ html:not([dir="rtl"]) .np-navigation-option {
5219
5211
  background-color: #ffffff;
5220
5212
  background-color: var(--color-background-screen);
5221
5213
  }
5214
+ .np-switch-option.disabled .np-switch {
5215
+ filter: none;
5216
+ opacity: 1;
5217
+ }
5222
5218
  .tabs {
5223
5219
  position: relative;
5224
5220
  }
package/src/main.less CHANGED
@@ -65,6 +65,7 @@
65
65
  @import "./segmentedControl/SegmentedControl.less";
66
66
  @import "./summary/Summary.less";
67
67
  @import "./switch/Switch.less";
68
+ @import "./switchOption/SwitchOption.less";
68
69
  @import "./tabs/Tabs.less";
69
70
  @import "./table/Table.less";
70
71
  @import "./tile/Tile.less";
@@ -10,10 +10,11 @@ import { lorem10, lorem100, lorem1000, storyConfig } from '../test-utils';
10
10
  export default {
11
11
  component: Modal,
12
12
  title: 'Dialogs/Modal',
13
+ tags: ['autodocs'],
13
14
  args: {
14
15
  size: 'md',
15
16
  position: 'center',
16
- open: true,
17
+ open: false,
17
18
  },
18
19
  parameters: {
19
20
  chromatic: {
@@ -27,10 +28,11 @@ type Story = StoryObj<typeof Modal>;
27
28
  export interface StoryContentProps {
28
29
  args: CommonProps & ModalProps;
29
30
  screenMode?: ScreenMode;
31
+ viewMode?: string;
30
32
  }
31
33
 
32
- const StoryContent = ({ args, screenMode }: StoryContentProps) => {
33
- const [open, setOpen] = useState(args.open);
34
+ const StoryContent = ({ args, screenMode, viewMode }: StoryContentProps) => {
35
+ const [open, setOpen] = useState(viewMode !== 'docs');
34
36
 
35
37
  return (
36
38
  <>
@@ -70,7 +72,7 @@ export const Basic: Story = {
70
72
  </Button>
71
73
  ),
72
74
  },
73
- render: (args) => <StoryContent args={args} />,
75
+ render: (args, context) => <StoryContent args={args} viewMode={context.viewMode} />,
74
76
  };
75
77
 
76
78
  export const BasicMobile: Story = storyConfig(Basic, { variants: ['mobile'] });
@@ -81,6 +83,7 @@ export const ContentScroll: Story = {
81
83
  body: lorem1000,
82
84
  scroll: Scroll.CONTENT,
83
85
  },
86
+ render: (args, context) => <StoryContent args={args} viewMode={context.viewMode} />,
84
87
  };
85
88
 
86
89
  export const ContentScrollMobile: Story = storyConfig(ContentScroll, { variants: ['mobile'] });
@@ -91,6 +94,7 @@ export const ViewportScroll: Story = {
91
94
  body: lorem1000,
92
95
  scroll: Scroll.VIEWPORT,
93
96
  },
97
+ render: (args, context) => <StoryContent args={args} viewMode={context.viewMode} />,
94
98
  };
95
99
 
96
100
  export const ViewportScrollMobile: Story = storyConfig(ViewportScroll, { variants: ['mobile'] });
@@ -100,6 +104,7 @@ export const WithoutTitle: Story = {
100
104
  body: lorem1000,
101
105
  scroll: Scroll.CONTENT,
102
106
  },
107
+ render: (args, context) => <StoryContent args={args} viewMode={context.viewMode} />,
103
108
  };
104
109
 
105
110
  export const WithoutTitleMobile: Story = storyConfig(WithoutTitle, { variants: ['mobile'] });
@@ -115,9 +120,9 @@ export const WithThemeProviderInContent: Story = {
115
120
  </Button>
116
121
  ),
117
122
  },
118
- render: (args, { globals: { screenMode } }) => (
123
+ render: (args, { globals: { screenMode }, viewMode }) => (
119
124
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
120
- <StoryContent args={args} screenMode={screenMode} />
125
+ <StoryContent args={args} screenMode={screenMode} viewMode={viewMode} />
121
126
  ),
122
127
  };
123
128
 
@@ -5,6 +5,7 @@ import Money from './Money';
5
5
  export default {
6
6
  component: Money,
7
7
  title: 'Typography/Money',
8
+ tags: ['autodocs'],
8
9
  } satisfies Meta<typeof Money>;
9
10
 
10
11
  type Story = StoryObj<typeof Money>;
@@ -5,6 +5,7 @@ import NavigationOptionsList from '.';
5
5
  export default {
6
6
  component: NavigationOptionsList,
7
7
  title: 'Option/NavigationOptionsList',
8
+ tags: ['autodocs'],
8
9
  };
9
10
 
10
11
  export const Basic = () => {
@@ -6,6 +6,7 @@ import { Nudge } from '..';
6
6
  export default {
7
7
  component: Nudge,
8
8
  title: 'Feedback/Nudge',
9
+ tags: ['autodocs'],
9
10
  };
10
11
 
11
12
  export const Default = () => {
@@ -11,6 +11,7 @@ import OverlayHeader from './OverlayHeader';
11
11
  export default {
12
12
  component: OverlayHeader,
13
13
  title: 'Navigation/OverlayHeader',
14
+ tags: ['autodocs'],
14
15
  };
15
16
 
16
17
  const avatarProfiles = {
@@ -5,6 +5,7 @@ import Progress from './Progress';
5
5
  export default {
6
6
  component: Progress,
7
7
  title: 'Other/Progress',
8
+ tags: ['autodocs'],
8
9
  } satisfies Meta<typeof Progress>;
9
10
 
10
11
  type Story = StoryObj<typeof Progress>;
@@ -7,6 +7,7 @@ import closeButtonMessages from '../common/closeButton/CloseButton.messages';
7
7
  export default {
8
8
  component: Provider,
9
9
  title: 'Other/Provider',
10
+ tags: ['autodocs'],
10
11
  } satisfies Meta<typeof Provider>;
11
12
 
12
13
  type Story = StoryObj<typeof Provider>;
@@ -7,6 +7,7 @@ import { Flag } from '@wise/art';
7
7
  export default {
8
8
  component: Radio,
9
9
  title: 'Forms/Radio',
10
+ tags: ['autodocs'],
10
11
  };
11
12
 
12
13
  export const Basic = () => {
@@ -9,6 +9,7 @@ import AvatarView from '../avatarView';
9
9
  const meta = {
10
10
  component: RadioGroup,
11
11
  title: 'Forms/RadioGroup',
12
+ tags: ['autodocs'],
12
13
  } satisfies Meta<typeof RadioGroup>;
13
14
 
14
15
  export default meta;
@@ -10,6 +10,7 @@ import RadioOption, { RadioOptionProps } from './RadioOption';
10
10
  export default {
11
11
  component: RadioOption,
12
12
  title: 'Option/RadioOption',
13
+ tags: ['autodocs'],
13
14
  };
14
15
 
15
16
  const Template = (props: Partial<RadioOptionProps>) => {
@@ -11,6 +11,7 @@ import Section from './Section';
11
11
  export default {
12
12
  component: Section,
13
13
  title: 'Content/Section',
14
+ tags: ['autodocs'],
14
15
  };
15
16
 
16
17
  export const Basic = () => {
@@ -8,6 +8,7 @@ import SegmentedControl from './SegmentedControl';
8
8
  export default {
9
9
  component: SegmentedControl,
10
10
  title: 'Forms/SegmentedControl',
11
+ tags: ['autodocs'],
11
12
  };
12
13
 
13
14
  const Template: StoryFn = (args) => {
@@ -10,6 +10,7 @@ import Select, { SelectItem, SelectOptionItem } from './Select';
10
10
  export default {
11
11
  component: Select,
12
12
  title: 'Forms/Select (Deprecated)',
13
+ tags: ['autodocs'],
13
14
  };
14
15
 
15
16
  const ImageIcon = () => (
@@ -8,6 +8,7 @@ import SlidingPanel from './SlidingPanel';
8
8
  export default {
9
9
  component: SlidingPanel,
10
10
  title: 'Dialogs/SlidingPanel',
11
+ tags: ['autodocs'],
11
12
  };
12
13
 
13
14
  export const Basic = () => {
@@ -13,6 +13,7 @@ import SnackbarProvider from './SnackbarProvider';
13
13
  export default {
14
14
  component: Snackbar,
15
15
  title: 'Dialogs/Snackbar',
16
+ tags: ['autodocs'],
16
17
  };
17
18
 
18
19
  export const Basic = () => {
@@ -9,6 +9,7 @@ import Summary from './Summary';
9
9
  export default {
10
10
  component: Summary,
11
11
  title: 'Content/Summary',
12
+ tags: ['autodocs'],
12
13
  };
13
14
 
14
15
  export const Basic = () => {
@@ -1,4 +1,8 @@
1
- .np-switch {
1
+ @media (min-width: 768px) {
2
+ }@media (min-width: 768px) {
3
+ }.np-switch {
4
+ all: unset;
5
+ box-sizing: border-box;
2
6
  display: inline-flex;
3
7
  overflow: hidden;
4
8
  width: 50px;
@@ -7,61 +11,38 @@
7
11
  -webkit-user-select: none;
8
12
  -moz-user-select: none;
9
13
  user-select: none;
10
- }
11
- .np-switch:focus {
14
+ cursor: pointer;
15
+ }.np-switch:focus {
12
16
  outline: none;
13
- }
14
- .np-switch:focus-visible {
17
+ }.np-switch:focus-visible {
15
18
  outline: var(--ring-outline-color) solid var(--ring-outline-width);
16
19
  outline-offset: var(--ring-outline-offset);
17
- }
18
- .np-switch--thumb {
20
+ }.np-switch--thumb {
19
21
  display: flex;
20
22
  transition: transform cubic-bezier(0, 0.94, 0.62, 1) 350ms;
21
- }
22
- .np-switch--thumb .tw-icon {
23
+ }.np-switch--thumb .tw-icon {
23
24
  color: #fff;
24
- }
25
- .np-switch--unchecked {
25
+ }.np-switch--unchecked {
26
26
  background: #c9cbce;
27
27
  background: var(--color-interactive-secondary);
28
- }
29
- .np-switch--unchecked .switch--thumb {
28
+ }.np-switch--unchecked .switch--thumb {
30
29
  transform: translateX(0);
31
- }
32
- .np-switch--checked {
30
+ }.np-switch--checked {
33
31
  background: #00a2dd;
34
32
  background: var(--color-interactive-accent);
35
- }
36
- .np-switch--checked .np-switch--thumb {
33
+ }.np-switch--checked .np-switch--thumb {
37
34
  transform: translateX(20px) ;
38
- }
39
- [dir="rtl"] .np-switch--checked .np-switch--thumb {
35
+ }[dir="rtl"] .np-switch--checked .np-switch--thumb {
40
36
  transform: translateX(-20px) ;
41
- }
42
- .np-switch input {
43
- position: absolute;
44
- left: -100%;
45
- display: none;
46
- width: 0;
47
- height: 0;
48
- opacity: 0;
49
- }
50
- [dir="rtl"] .np-switch input {
51
- right: -100%;
52
- left: auto;
53
- left: initial;
54
- }
55
- .np-switch:not([aria-disabled]) {
56
- cursor: pointer;
57
- }
58
- .np-theme-personal .np-switch {
37
+ }.np-switch.disabled {
38
+ filter: grayscale(1);
39
+ opacity: 0.45;
40
+ cursor: not-allowed !important;
41
+ }.np-theme-personal .np-switch {
59
42
  padding: 1px 2px;
60
- }
61
- .np-theme-personal .np-switch--checked {
43
+ }.np-theme-personal .np-switch--checked {
62
44
  background: var(--color-interactive-primary);
63
- }
64
- .np-theme-personal .np-switch--thumb {
45
+ }.np-theme-personal .np-switch--thumb {
65
46
  width: 20px;
66
47
  height: 20px;
67
48
  margin: 3px;
@@ -1,14 +1,18 @@
1
1
  @import (reference) "../../node_modules/@transferwise/neptune-css/src/variables/neptune-tokens.less";
2
2
  @import (reference) "../../node_modules/@transferwise/neptune-css/src/less/mixins/_logical-properties.less";
3
3
  @import (reference) "../../node_modules/@transferwise/neptune-css/src/less/ring.less";
4
+ @import (reference) "../../node_modules/@transferwise/neptune-css/src/less/core/_scaffolding.less";
4
5
 
5
6
  .np-switch {
7
+ all: unset;
8
+ box-sizing: border-box;
6
9
  display: inline-flex;
7
10
  overflow: hidden;
8
11
  width: 50px;
9
12
  padding: 2px;
10
13
  border-radius: 16px;
11
14
  user-select: none;
15
+ cursor: pointer;
12
16
 
13
17
  .focus-ring();
14
18
 
@@ -37,18 +41,8 @@
37
41
  }
38
42
  }
39
43
 
40
- input {
41
- position: absolute;
42
- .left(-100%);
43
-
44
- display: none;
45
- width: 0;
46
- height: 0;
47
- opacity: 0;
48
- }
49
-
50
- &:not([aria-disabled]) {
51
- cursor: pointer;
44
+ &.disabled{
45
+ .disabled();
52
46
  }
53
47
  }
54
48
 
@@ -1,5 +1,5 @@
1
1
  import { Field } from '../field/Field';
2
- import { render, fireEvent, screen } from '../test-utils';
2
+ import { render, userEvent, fireEvent, screen } from '../test-utils';
3
3
 
4
4
  import Switch from './Switch';
5
5
 
@@ -22,7 +22,7 @@ describe('Switch', () => {
22
22
  onClick={props.onClick}
23
23
  />,
24
24
  );
25
- expect(container).toMatchSnapshot();
25
+ expect(screen.getByRole('switch')).toBeChecked();
26
26
  });
27
27
 
28
28
  it('renders component associated with label', () => {
@@ -54,25 +54,27 @@ describe('Switch', () => {
54
54
  onClick={props.onClick}
55
55
  />,
56
56
  );
57
- expect(container).toMatchSnapshot();
57
+ expect(screen.getByLabelText(props['aria-label'])).not.toBeChecked();
58
58
  });
59
59
 
60
- it('calls onClick when user press space key', () => {
60
+ it('calls onClick when user press space or enter key', async () => {
61
61
  render(
62
62
  <Switch
63
- checked={props.checked}
64
63
  className={props.className}
65
- id={props.id}
66
64
  aria-label={props['aria-label']}
67
65
  onClick={props.onClick}
68
66
  />,
69
67
  );
70
68
 
71
- const input = screen.getAllByRole('checkbox')[0];
72
- fireEvent.keyDown(input, { key: 'Enter' });
73
69
  expect(props.onClick).not.toHaveBeenCalled();
74
- fireEvent.keyDown(input, { key: ' ' });
70
+
71
+ await userEvent.tab();
72
+
73
+ await userEvent.keyboard(' ');
75
74
  expect(props.onClick).toHaveBeenCalledTimes(1);
75
+
76
+ await userEvent.keyboard('{Enter}');
77
+ expect(props.onClick).toHaveBeenCalledTimes(2);
76
78
  });
77
79
 
78
80
  it('should not call onClick if disabled', () => {