@coveord/plasma-mantine 48.2.0 → 48.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveord/plasma-mantine",
3
- "version": "48.2.0",
3
+ "version": "48.2.1",
4
4
  "description": "A Plasma flavoured Mantine theme",
5
5
  "keywords": [
6
6
  "plasma",
@@ -46,7 +46,7 @@
46
46
  "@testing-library/dom": "8.18.1",
47
47
  "@testing-library/jest-dom": "5.16.5",
48
48
  "@testing-library/react": "13.4.0",
49
- "@testing-library/user-event": "12.8.3",
49
+ "@testing-library/user-event": "14.4.3",
50
50
  "@types/jest": "29.1.2",
51
51
  "@types/lodash.defaultsdeep": "4.6.7",
52
52
  "@types/react": "18.0.21",
@@ -24,6 +24,7 @@ describe('Collection', () => {
24
24
  });
25
25
 
26
26
  it('removes the item when clicking on its remove button', async () => {
27
+ const user = userEvent.setup({delay: null});
27
28
  const Fixture = () => {
28
29
  const form = useForm({initialValues: {fruits: ['banana', 'orange']}});
29
30
  return (
@@ -42,7 +43,7 @@ describe('Collection', () => {
42
43
  /* eslint-disable-next-line testing-library/no-node-access */
43
44
  const removeBanana = await within(items[0].parentElement).findByRole('button', {name: /remove/i});
44
45
 
45
- userEvent.click(removeBanana);
46
+ await user.click(removeBanana);
46
47
 
47
48
  items = screen.getAllByTestId('item');
48
49
  // eslint-disable-next-line jest-dom/prefer-in-document
@@ -52,6 +53,7 @@ describe('Collection', () => {
52
53
  });
53
54
 
54
55
  it('calls the onRemoveItem function when clicking on a remove button', async () => {
56
+ const user = userEvent.setup({delay: null});
55
57
  const onRemoveItemSpy = jest.fn();
56
58
  const Fixture = () => {
57
59
  const form = useForm({initialValues: {fruits: ['banana', 'orange']}});
@@ -67,18 +69,19 @@ describe('Collection', () => {
67
69
  expect(items).toHaveLength(2);
68
70
  /* eslint-disable-next-line testing-library/no-node-access */
69
71
  const removeOrange = await within(items[1].parentElement).findByRole('button', {name: /remove/i});
70
- userEvent.click(removeOrange);
72
+ await user.click(removeOrange);
71
73
 
72
74
  expect(onRemoveItemSpy).toHaveBeenCalledWith(1);
73
75
 
74
76
  items = screen.getAllByTestId('item');
75
77
  const removeBanana = await within(items[0].parentElement).findByRole('button', {name: /remove/i});
76
- userEvent.click(removeBanana);
78
+ await user.click(removeBanana);
77
79
 
78
80
  expect(onRemoveItemSpy).toHaveBeenCalledWith(0);
79
81
  });
80
82
 
81
83
  it('does not render the remove button when disabled', async () => {
84
+ const user = userEvent.setup({delay: null});
82
85
  const Fixture = () => {
83
86
  const [disabled, setDisabled] = useState(false);
84
87
  const form = useForm({initialValues: {fruits: ['banana', 'orange']}});
@@ -94,11 +97,12 @@ describe('Collection', () => {
94
97
 
95
98
  render(<Fixture />);
96
99
  await screen.findAllByRole('button', {name: /remove/i});
97
- userEvent.click(screen.getByRole('button', {name: /disable/i}));
100
+ await user.click(screen.getByRole('button', {name: /disable/i}));
98
101
  expect(screen.queryByRole('button', {name: /remove/i})).not.toBeInTheDocument();
99
102
  });
100
103
 
101
- it('adds a new item when clicking on the add button', () => {
104
+ it('adds a new item when clicking on the add button', async () => {
105
+ const user = userEvent.setup({delay: null});
102
106
  const Fixture = () => {
103
107
  const form = useForm({initialValues: {fruits: ['banana', 'orange']}});
104
108
  return (
@@ -113,7 +117,7 @@ describe('Collection', () => {
113
117
 
114
118
  render(<Fixture />);
115
119
  const addItem = screen.getByRole('button', {name: /add/i});
116
- userEvent.click(addItem);
120
+ await user.click(addItem);
117
121
 
118
122
  const items = screen.getAllByTestId('item');
119
123
  expect(items).toHaveLength(3);
@@ -190,6 +194,7 @@ describe('Collection', () => {
190
194
  });
191
195
 
192
196
  it('not render the remove button after removing an item from a collection containing two items', async () => {
197
+ const user = userEvent.setup({delay: null});
193
198
  const Fixture = () => {
194
199
  const form = useForm({initialValues: {fruits: ['banana', 'orange']}});
195
200
  return (
@@ -211,7 +216,7 @@ describe('Collection', () => {
211
216
  expect(items[0]).toHaveTextContent('banana');
212
217
  expect(items[1]).toHaveTextContent('orange');
213
218
 
214
- userEvent.click(removeButtons[1]);
219
+ await user.click(removeButtons[1]);
215
220
 
216
221
  expect(screen.queryByRole('button', {name: /remove/i})).not.toBeInTheDocument();
217
222
  });
@@ -238,6 +243,7 @@ describe('Collection', () => {
238
243
 
239
244
  describe('when required is true', () => {
240
245
  it('not render the remove button after removing an item from a collection containing two items', async () => {
246
+ const user = userEvent.setup({delay: null});
241
247
  const Fixture = () => {
242
248
  const form = useForm({initialValues: {fruits: ['banana', 'orange']}});
243
249
  return (
@@ -265,7 +271,7 @@ describe('Collection', () => {
265
271
  expect(items[0]).toHaveTextContent('banana');
266
272
  expect(items[1]).toHaveTextContent('orange');
267
273
 
268
- userEvent.click(removeButtons[1]);
274
+ await user.click(removeButtons[1]);
269
275
 
270
276
  expect(screen.queryByRole('button', {name: /remove/i})).not.toBeInTheDocument();
271
277
  });
@@ -4,21 +4,23 @@ import dayjs from 'dayjs';
4
4
  import {DateRangePickerInlineCalendar} from '../DateRangePickerInlineCalendar';
5
5
 
6
6
  describe('DateRangePickerInlineCalendar', () => {
7
- it('calls onApply when the user clicks on the apply button', () => {
7
+ it('calls onApply when the user clicks on the apply button', async () => {
8
+ const user = userEvent.setup({delay: null});
8
9
  const onApply = jest.fn();
9
10
  render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={jest.fn()} />);
10
11
 
11
- userEvent.click(screen.getByRole('button', {name: 'Apply'}));
12
+ await user.click(screen.getByRole('button', {name: 'Apply'}));
12
13
 
13
14
  expect(onApply).toHaveBeenCalledTimes(1);
14
15
  expect(onApply).toHaveBeenCalledWith([null, null]);
15
16
  });
16
17
 
17
- it('calls onCancel when the user clicks on the cancel button', () => {
18
+ it('calls onCancel when the user clicks on the cancel button', async () => {
19
+ const user = userEvent.setup({delay: null});
18
20
  const onCancel = jest.fn();
19
21
  render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={jest.fn()} onCancel={onCancel} />);
20
22
 
21
- userEvent.click(screen.getByRole('button', {name: 'Cancel'}));
23
+ await user.click(screen.getByRole('button', {name: 'Cancel'}));
22
24
 
23
25
  expect(onCancel).toHaveBeenCalledTimes(1);
24
26
  });
@@ -29,7 +31,8 @@ describe('DateRangePickerInlineCalendar', () => {
29
31
  expect(screen.queryByRole('searchbox')).not.toBeInTheDocument();
30
32
  });
31
33
 
32
- it('calls onApply with the selected dates when choosing a preset', () => {
34
+ it('calls onApply with the selected dates when choosing a preset', async () => {
35
+ const user = userEvent.setup({delay: null});
33
36
  const onApply = jest.fn();
34
37
  render(
35
38
  <DateRangePickerInlineCalendar
@@ -42,50 +45,52 @@ describe('DateRangePickerInlineCalendar', () => {
42
45
  />
43
46
  );
44
47
 
45
- userEvent.click(
48
+ await user.click(
46
49
  screen.getByRole('searchbox', {
47
50
  name: 'Date range',
48
51
  })
49
52
  );
50
- userEvent.click(screen.getByRole('option', {name: 'select me'}));
51
- userEvent.click(screen.getByRole('button', {name: 'Apply'}));
53
+ await user.click(screen.getByRole('option', {name: 'select me'}));
54
+ await user.click(screen.getByRole('button', {name: 'Apply'}));
52
55
 
53
56
  expect(onApply).toHaveBeenCalledWith([new Date(1999, 11, 31), new Date(2000, 0, 1)]);
54
57
  });
55
58
 
56
- it('calls onApply with the selected dates when clicking in the calendar', () => {
59
+ it('calls onApply with the selected dates when clicking in the calendar', async () => {
60
+ const user = userEvent.setup({delay: null});
57
61
  jest.useFakeTimers().setSystemTime(new Date(2022, 0, 31));
58
62
  const onApply = jest.fn();
59
63
  render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={jest.fn()} />);
60
64
 
61
65
  // click once for the start, once for the end
62
- userEvent.click(screen.getAllByRole('button', {name: '8'})[0]);
63
- userEvent.click(screen.getAllByRole('button', {name: '14'})[0]);
66
+ await user.click(screen.getAllByRole('button', {name: '8'})[0]);
67
+ await user.click(screen.getAllByRole('button', {name: '14'})[0]);
64
68
 
65
- userEvent.click(screen.getByRole('button', {name: 'Apply'}));
69
+ await user.click(screen.getByRole('button', {name: 'Apply'}));
66
70
 
67
71
  expect(onApply).toHaveBeenCalledWith([new Date(2022, 0, 8), new Date(2022, 0, 14)]);
68
72
 
69
73
  jest.useRealTimers();
70
74
  });
71
75
 
72
- it('calls onApply with the selected dates when typing in the inputs', () => {
76
+ it('calls onApply with the selected dates when typing in the inputs', async () => {
77
+ const user = userEvent.setup({delay: null});
73
78
  const onApply = jest.fn();
74
79
  render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={jest.fn()} />);
75
80
 
76
81
  const startInput = screen.getByRole('textbox', {
77
82
  name: /start/i,
78
83
  });
79
- userEvent.clear(startInput);
80
- userEvent.type(startInput, 'Jan 8, 2022');
84
+ await user.clear(startInput);
85
+ await user.type(startInput, 'Jan 8, 2022');
81
86
 
82
87
  const endInput = screen.getByRole('textbox', {
83
88
  name: /end/i,
84
89
  });
85
- userEvent.clear(endInput);
86
- userEvent.type(endInput, 'Jan 14, 2022');
90
+ await user.clear(endInput);
91
+ await user.type(endInput, 'Jan 14, 2022');
87
92
 
88
- userEvent.click(screen.getByRole('button', {name: 'Apply'}));
93
+ await user.click(screen.getByRole('button', {name: 'Apply'}));
89
94
 
90
95
  expect(onApply).toHaveBeenCalledWith([
91
96
  dayjs(new Date(2022, 0, 8)).startOf('day').toDate(),
@@ -19,7 +19,8 @@ describe('DateRangePickerPopoverCalendar', () => {
19
19
  expect(screen.queryByRole('searchbox')).not.toBeInTheDocument();
20
20
  });
21
21
 
22
- it('updates with the selected dates when choosing a preset', () => {
22
+ it('updates with the selected dates when choosing a preset', async () => {
23
+ const user = userEvent.setup({delay: null});
23
24
  const Fixture = () => {
24
25
  const form = useForm<{dates: DateRangePickerValue}>({initialValues: {dates: [null, null]}});
25
26
  return (
@@ -36,17 +37,18 @@ describe('DateRangePickerPopoverCalendar', () => {
36
37
  };
37
38
  render(<Fixture />);
38
39
 
39
- userEvent.click(
40
+ await user.click(
40
41
  screen.getByRole('searchbox', {
41
42
  name: 'Date range',
42
43
  })
43
44
  );
44
- userEvent.click(screen.getByRole('option', {name: 'select me'}));
45
+ await user.click(screen.getByRole('option', {name: 'select me'}));
45
46
 
46
47
  expect(screen.getByTestId('json')).toHaveTextContent('["1999-12-31T00:00:00.000Z","2000-01-01T00:00:00.000Z"]');
47
48
  });
48
49
 
49
- it('calls onApply with the selected dates when clicking in the calendar', () => {
50
+ it('calls onApply with the selected dates when clicking in the calendar', async () => {
51
+ const user = userEvent.setup({delay: null});
50
52
  jest.useFakeTimers().setSystemTime(new Date(2022, 0, 31));
51
53
  const Fixture = () => {
52
54
  const form = useForm<{dates: DateRangePickerValue}>({initialValues: {dates: [null, null]}});
@@ -59,10 +61,10 @@ describe('DateRangePickerPopoverCalendar', () => {
59
61
  };
60
62
  render(<Fixture />);
61
63
 
62
- userEvent.click(screen.getByRole('textbox', {name: 'Start'}));
64
+ await user.click(screen.getByRole('textbox', {name: 'Start'}));
63
65
  // click once for the start, once for the end
64
- userEvent.click(screen.getAllByRole('button', {name: '8'})[0]);
65
- userEvent.click(screen.getAllByRole('button', {name: '14'})[0]);
66
+ await user.click(screen.getAllByRole('button', {name: '8'})[0]);
67
+ await user.click(screen.getAllByRole('button', {name: '14'})[0]);
66
68
 
67
69
  // hides the calendar when the second date is clicked
68
70
  expect(screen.queryByRole('button', {name: '8'})).not.toBeInTheDocument();
@@ -72,7 +74,8 @@ describe('DateRangePickerPopoverCalendar', () => {
72
74
  jest.useRealTimers();
73
75
  });
74
76
 
75
- it('calls onApply with the selected dates when typing in the inputs', () => {
77
+ it('calls onApply with the selected dates when typing in the inputs', async () => {
78
+ const user = userEvent.setup({delay: null});
76
79
  const Fixture = () => {
77
80
  const form = useForm<{dates: DateRangePickerValue}>({initialValues: {dates: [null, null]}});
78
81
  return (
@@ -87,14 +90,14 @@ describe('DateRangePickerPopoverCalendar', () => {
87
90
  const startInput = screen.getByRole('textbox', {
88
91
  name: /start/i,
89
92
  });
90
- userEvent.clear(startInput);
91
- userEvent.type(startInput, 'Jan 8, 2022');
93
+ await user.clear(startInput);
94
+ await user.type(startInput, 'Jan 8, 2022');
92
95
 
93
96
  const endInput = screen.getByRole('textbox', {
94
97
  name: /end/i,
95
98
  });
96
- userEvent.clear(endInput);
97
- userEvent.type(endInput, 'Jan 14, 2022');
99
+ await user.clear(endInput);
100
+ await user.type(endInput, 'Jan 14, 2022');
98
101
 
99
102
  expect(screen.getByTestId('json')).toHaveTextContent('["2022-01-08T00:00:00.000Z","2022-01-14T23:59:59.999Z"]');
100
103
  });
@@ -3,7 +3,8 @@ import {render, screen, userEvent} from '@test-utils';
3
3
  import {DateRangePickerPresetSelect} from '../DateRangePickerPresetSelect';
4
4
 
5
5
  describe('DateRangePickerPresetSelect', () => {
6
- it('calls onChange when selecting a preset', () => {
6
+ it('calls onChange when selecting a preset', async () => {
7
+ const user = userEvent.setup({delay: null});
7
8
  const onChange = jest.fn();
8
9
  render(
9
10
  <DateRangePickerPresetSelect
@@ -15,12 +16,12 @@ describe('DateRangePickerPresetSelect', () => {
15
16
  />
16
17
  );
17
18
 
18
- userEvent.click(
19
+ await user.click(
19
20
  screen.getByRole('searchbox', {
20
21
  name: 'Date range',
21
22
  })
22
23
  );
23
- userEvent.click(screen.getByRole('option', {name: 'select me'}));
24
+ await user.click(screen.getByRole('option', {name: 'select me'}));
24
25
 
25
26
  expect(onChange).toHaveBeenCalledWith([new Date(1999, 11, 31), new Date(2000, 0, 1)]);
26
27
  });
@@ -18,7 +18,8 @@ describe('EditableDateRangePicker', () => {
18
18
  expect(screen.getByText('SEPARATOR')).toBeVisible();
19
19
  });
20
20
 
21
- it('updates when editing values', () => {
21
+ it('updates when editing values', async () => {
22
+ const user = userEvent.setup({delay: null});
22
23
  const Fixture = () => {
23
24
  const [value, setValue] = useState<DateRangePickerValue>([null, null]);
24
25
  return (
@@ -33,14 +34,14 @@ describe('EditableDateRangePicker', () => {
33
34
  const startInput = screen.getByRole('textbox', {
34
35
  name: /start/i,
35
36
  });
36
- userEvent.clear(startInput);
37
- userEvent.type(startInput, 'Jan 8, 2022');
37
+ await user.clear(startInput);
38
+ await user.type(startInput, 'Jan 8, 2022');
38
39
 
39
40
  const endInput = screen.getByRole('textbox', {
40
41
  name: /end/i,
41
42
  });
42
- userEvent.clear(endInput);
43
- userEvent.type(endInput, 'Jan 14, 2022');
43
+ await user.clear(endInput);
44
+ await user.type(endInput, 'Jan 14, 2022');
44
45
 
45
46
  expect(screen.getByTestId('json')).toHaveTextContent('["2022-01-08T00:00:00.000Z","2022-01-14T23:59:59.999Z"]');
46
47
  });
@@ -9,7 +9,8 @@ describe('InlineConfirm', () => {
9
9
  expect(screen.getByText('Hello World')).toBeVisible();
10
10
  });
11
11
 
12
- it('calls the onClick prop when clicking on a button', () => {
12
+ it('calls the onClick prop when clicking on a button', async () => {
13
+ const user = userEvent.setup({delay: null});
13
14
  const onClickSpy = jest.fn();
14
15
  render(
15
16
  <InlineConfirm>
@@ -19,12 +20,13 @@ describe('InlineConfirm', () => {
19
20
  </InlineConfirm>
20
21
  );
21
22
 
22
- userEvent.click(screen.getByRole('button', {name: 'Delete'}));
23
+ await user.click(screen.getByRole('button', {name: 'Delete'}));
23
24
 
24
25
  expect(onClickSpy).toHaveBeenCalledTimes(1);
25
26
  });
26
27
 
27
- it('replace the children with a prompt when clicking on a button which requires confirmation', () => {
28
+ it('replace the children with a prompt when clicking on a button which requires confirmation', async () => {
29
+ const user = userEvent.setup({delay: null});
28
30
  render(
29
31
  <InlineConfirm>
30
32
  <InlineConfirm.Button id="my-button-id">Remove</InlineConfirm.Button>
@@ -34,13 +36,14 @@ describe('InlineConfirm', () => {
34
36
  expect(screen.queryByText('Are you sure?')).not.toBeInTheDocument();
35
37
  expect(screen.getByRole('button', {name: 'Remove'})).toBeVisible();
36
38
 
37
- userEvent.click(screen.getByRole('button', {name: 'Remove'}));
39
+ await user.click(screen.getByRole('button', {name: 'Remove'}));
38
40
 
39
41
  expect(screen.getByText('Are you sure?')).toBeVisible();
40
42
  expect(screen.queryByRole('button', {name: 'Remove'})).not.toBeInTheDocument();
41
43
  });
42
44
 
43
- it('hides the prompt when the user cancel and call onConfirm when the user confirms', () => {
45
+ it('hides the prompt when the user cancel and call onConfirm when the user confirms', async () => {
46
+ const user = userEvent.setup({delay: null});
44
47
  const confirmSpy = jest.fn();
45
48
  render(
46
49
  <InlineConfirm>
@@ -55,22 +58,23 @@ describe('InlineConfirm', () => {
55
58
  </InlineConfirm>
56
59
  );
57
60
 
58
- userEvent.click(screen.getByRole('button', {name: 'Remove'}));
61
+ await user.click(screen.getByRole('button', {name: 'Remove'}));
59
62
  expect(screen.getByText('Are you sure?')).toBeVisible();
60
63
 
61
- userEvent.click(screen.getByRole('button', {name: 'I changed my mind'}));
64
+ await user.click(screen.getByRole('button', {name: 'I changed my mind'}));
62
65
  expect(screen.queryByText('Are you sure?')).not.toBeInTheDocument();
63
66
  expect(confirmSpy).not.toHaveBeenCalled();
64
67
 
65
- userEvent.click(screen.getByRole('button', {name: 'Remove'}));
68
+ await user.click(screen.getByRole('button', {name: 'Remove'}));
66
69
  expect(screen.getByText('Are you sure?')).toBeVisible();
67
70
 
68
- userEvent.click(screen.getByRole('button', {name: 'I confirm'}));
71
+ await user.click(screen.getByRole('button', {name: 'I confirm'}));
69
72
  expect(screen.queryByText('Are you sure?')).not.toBeInTheDocument();
70
73
  expect(confirmSpy).toHaveBeenCalledTimes(1);
71
74
  });
72
75
 
73
- it('shows the prompt related to the clicked button', () => {
76
+ it('shows the prompt related to the clicked button', async () => {
77
+ const user = userEvent.setup({delay: null});
74
78
  render(
75
79
  <InlineConfirm>
76
80
  <InlineConfirm.Button id="remove">Remove</InlineConfirm.Button>
@@ -81,13 +85,13 @@ describe('InlineConfirm', () => {
81
85
  </InlineConfirm>
82
86
  );
83
87
 
84
- userEvent.click(screen.getByRole('button', {name: 'Remove'}));
88
+ await user.click(screen.getByRole('button', {name: 'Remove'}));
85
89
  expect(screen.getByText('Delete X?')).toBeVisible();
86
90
  expect(screen.queryByText('Print?')).not.toBeInTheDocument();
87
91
 
88
- userEvent.click(screen.getByRole('button', {name: 'Cancel'}));
92
+ await user.click(screen.getByRole('button', {name: 'Cancel'}));
89
93
 
90
- userEvent.click(screen.getByRole('button', {name: 'Print'}));
94
+ await user.click(screen.getByRole('button', {name: 'Print'}));
91
95
  expect(screen.queryByText('Delete X?')).not.toBeInTheDocument();
92
96
  expect(screen.getByText('Print?')).toBeVisible();
93
97
  });
@@ -2,7 +2,8 @@ import {render, screen, userEvent} from '@test-utils';
2
2
  import {ModalWizard} from '../ModalWizard';
3
3
 
4
4
  describe('ModalWizard', () => {
5
- it('navigate slides using footer buttons', () => {
5
+ it('navigate slides using footer buttons', async () => {
6
+ const user = userEvent.setup({delay: null});
6
7
  const modelSteps = [
7
8
  {
8
9
  docLink: 'https://google.com',
@@ -69,7 +70,7 @@ describe('ModalWizard', () => {
69
70
  });
70
71
  expect(nextButton).toBeInTheDocument();
71
72
 
72
- userEvent.click(nextButton);
73
+ await user.click(nextButton);
73
74
 
74
75
  expect(
75
76
  screen.getByRole('heading', {
@@ -96,7 +97,7 @@ describe('ModalWizard', () => {
96
97
  });
97
98
  expect(nextButton).toBeInTheDocument();
98
99
 
99
- userEvent.click(nextButton);
100
+ await user.click(nextButton);
100
101
 
101
102
  expect(
102
103
  screen.getByRole('heading', {
@@ -125,7 +126,7 @@ describe('ModalWizard', () => {
125
126
  expect(nextButton).toBeInTheDocument();
126
127
  expect(nextButton).toBeDisabled();
127
128
 
128
- userEvent.click(
129
+ await user.click(
129
130
  screen.getByRole('button', {
130
131
  name: /previous/i,
131
132
  })
@@ -152,7 +153,8 @@ describe('ModalWizard', () => {
152
153
  ).toBeInTheDocument();
153
154
  });
154
155
 
155
- it('modal wizard onClose', () => {
156
+ it('modal wizard onClose', async () => {
157
+ const user = userEvent.setup({delay: null});
156
158
  const modelSteps = [
157
159
  {
158
160
  docLink: 'https://google.com',
@@ -182,12 +184,13 @@ describe('ModalWizard', () => {
182
184
  const closeButton = screen.getByRole('button', {
183
185
  name: /closebuttonlabel/i,
184
186
  });
185
- userEvent.click(closeButton);
187
+ await user.click(closeButton);
186
188
 
187
189
  expect(onClose).toHaveBeenCalledTimes(1);
188
190
  });
189
191
 
190
- it('modal wizard onCancel', () => {
192
+ it('modal wizard onCancel', async () => {
193
+ const user = userEvent.setup({delay: null});
191
194
  const modelSteps = [
192
195
  {
193
196
  docLink: 'https://google.com',
@@ -217,12 +220,13 @@ describe('ModalWizard', () => {
217
220
  const cancelButton = screen.getByRole('button', {
218
221
  name: /cancel/i,
219
222
  });
220
- userEvent.click(cancelButton);
223
+ await user.click(cancelButton);
221
224
 
222
225
  expect(onClose).toHaveBeenCalledTimes(1);
223
226
  });
224
227
 
225
- it('modal wizard onFinish', () => {
228
+ it('modal wizard onFinish', async () => {
229
+ const user = userEvent.setup({delay: null});
226
230
  const modelSteps = [
227
231
  {
228
232
  docLink: 'https://google.com',
@@ -254,11 +258,12 @@ describe('ModalWizard', () => {
254
258
  name: /finish/i,
255
259
  });
256
260
 
257
- userEvent.click(finishButton);
261
+ await user.click(finishButton);
258
262
  expect(onFinish).toHaveBeenCalledTimes(1);
259
263
  });
260
264
 
261
- it('handle dirty state if user confirms close', () => {
265
+ it('handle dirty state if user confirms close', async () => {
266
+ const user = userEvent.setup({delay: null});
262
267
  const modelSteps = [
263
268
  {
264
269
  docLink: 'https://google.com',
@@ -295,13 +300,14 @@ describe('ModalWizard', () => {
295
300
  });
296
301
 
297
302
  handleDirtyState.mockReturnValueOnce(true);
298
- userEvent.click(closeButton);
303
+ await user.click(closeButton);
299
304
 
300
305
  expect(handleDirtyState).toHaveBeenCalledTimes(1);
301
306
  expect(onClose).toHaveBeenCalledTimes(1);
302
307
  });
303
308
 
304
- it('handle dirty state if user confirms cancel', () => {
309
+ it('handle dirty state if user confirms cancel', async () => {
310
+ const user = userEvent.setup({delay: null});
305
311
  const modelSteps = [
306
312
  {
307
313
  docLink: 'https://google.com',
@@ -338,7 +344,7 @@ describe('ModalWizard', () => {
338
344
  });
339
345
 
340
346
  handleDirtyState.mockReturnValueOnce(false);
341
- userEvent.click(closeButton);
347
+ await user.click(closeButton);
342
348
  expect(handleDirtyState).toHaveBeenCalledTimes(1);
343
349
  expect(onClose).toHaveBeenCalledTimes(0);
344
350
  });
@@ -69,6 +69,7 @@ describe('Table', () => {
69
69
  });
70
70
 
71
71
  it('opens the collapsible rows when the user click on the toggle', async () => {
72
+ const user = userEvent.setup({delay: null});
72
73
  const Fixture: FunctionComponent<{row: RowData}> = ({row}) => <div>Collapsible content: {row.lastName}</div>;
73
74
  const customColumns: Array<ColumnDef<RowData>> = [
74
75
  columnHelper.accessor('firstName', {
@@ -89,7 +90,7 @@ describe('Table', () => {
89
90
 
90
91
  expect(screen.queryByText('Collapsible content: last')).not.toBeVisible();
91
92
 
92
- userEvent.click(screen.getByRole('button', {name: 'arrowHeadDown'}));
93
+ await user.click(screen.getByRole('button', {name: 'arrowHeadDown'}));
93
94
  await waitFor(() => {
94
95
  expect(screen.queryByText('Collapsible content: last')).toBeVisible();
95
96
  });
@@ -126,7 +127,8 @@ describe('Table', () => {
126
127
  expect(allRows).toHaveLength(2);
127
128
  });
128
129
 
129
- it('reset row selection when user click outside the table', () => {
130
+ it('reset row selection when user click outside the table', async () => {
131
+ const user = userEvent.setup({delay: null});
130
132
  render(
131
133
  <div>
132
134
  <div>I'm a header</div>
@@ -144,11 +146,11 @@ describe('Table', () => {
144
146
 
145
147
  expect(row).not.toHaveClass('__mantine-ref-rowSelected');
146
148
 
147
- userEvent.click(row);
149
+ await user.click(row);
148
150
 
149
151
  expect(row).toHaveClass('__mantine-ref-rowSelected');
150
152
 
151
- userEvent.click(screen.getByText(/i'm a header/i));
153
+ await user.click(screen.getByText(/i'm a header/i));
152
154
 
153
155
  expect(row).not.toHaveClass('__mantine-ref-rowSelected');
154
156
  });
@@ -10,7 +10,8 @@ const columnHelper = createColumnHelper<RowData>();
10
10
  const columns: Array<ColumnDef<RowData>> = [columnHelper.accessor('name', {enableSorting: false})];
11
11
 
12
12
  describe('Table.Actions', () => {
13
- it('displays the actions when the row is selected', () => {
13
+ it('displays the actions when the row is selected', async () => {
14
+ const user = userEvent.setup({delay: null});
14
15
  render(
15
16
  <Table<RowData> data={[{name: 'fruit'}, {name: 'vegetable'}]} columns={columns}>
16
17
  <Table.Header>
@@ -24,12 +25,12 @@ describe('Table.Actions', () => {
24
25
  expect(screen.queryByRole('button', {name: 'Eat vegetable'})).not.toBeInTheDocument();
25
26
 
26
27
  // select the fruit row
27
- userEvent.click(screen.getByRole('cell', {name: 'fruit'}));
28
+ await user.click(screen.getByRole('cell', {name: 'fruit'}));
28
29
  expect(screen.getByRole('button', {name: 'Eat fruit'})).toBeVisible();
29
30
  expect(screen.queryByRole('button', {name: 'Eat vegetable'})).not.toBeInTheDocument();
30
31
 
31
32
  // select the vegetable row
32
- userEvent.click(screen.getByRole('cell', {name: 'vegetable'}));
33
+ await user.click(screen.getByRole('cell', {name: 'vegetable'}));
33
34
  expect(screen.queryByRole('button', {name: 'Eat fruit'})).not.toBeInTheDocument();
34
35
  expect(screen.getByRole('button', {name: 'Eat vegetable'})).toBeVisible();
35
36
  });
@@ -46,6 +46,7 @@ describe('Table.DateRangePicker', () => {
46
46
  });
47
47
 
48
48
  it('displays the selected date range in the table', async () => {
49
+ const user = userEvent.setup({delay: null});
49
50
  const onChange = jest.fn();
50
51
  render(
51
52
  <Table
@@ -65,19 +66,19 @@ describe('Table.DateRangePicker', () => {
65
66
  await screen.findByText('Jan 01, 2022 - Jan 07, 2022');
66
67
  await screen.findByRole('button', {name: 'calendar'});
67
68
 
68
- userEvent.click(screen.getByRole('button', {name: 'calendar'}));
69
+ await user.click(screen.getByRole('button', {name: 'calendar'}));
69
70
 
70
71
  await screen.findByRole('dialog');
71
72
 
72
73
  // select a preset
73
- userEvent.click(
74
+ await user.click(
74
75
  screen.getByRole('searchbox', {
75
76
  name: 'Date range',
76
77
  })
77
78
  );
78
- userEvent.click(screen.getByRole('option', {name: 'Preset'}));
79
+ await user.click(screen.getByRole('option', {name: 'Preset'}));
79
80
 
80
- userEvent.click(screen.getByRole('button', {name: 'Apply'}));
81
+ await user.click(screen.getByRole('button', {name: 'Apply'}));
81
82
 
82
83
  await waitFor(() => expect(screen.queryByText('Jan 08, 2022 - Jan 14, 2022')).toBeVisible());
83
84
  expect(onChange).toHaveBeenCalledWith(