@coveord/plasma-mantine 48.1.1 → 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.
@@ -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
  });
@@ -29,13 +29,20 @@ import {Th} from './Th';
29
29
  const useStyles = createStyles<string, {hasHeader: boolean}>((theme, {hasHeader}, getRef) => ({
30
30
  table: {
31
31
  width: '100%',
32
+ '& td:first-child': {
33
+ paddingLeft: theme.spacing.md,
34
+ },
32
35
  },
36
+
33
37
  header: {
34
38
  position: 'sticky',
35
39
  top: hasHeader ? 69 : 0,
36
40
  backgroundColor: theme.colorScheme === 'dark' ? theme.black : theme.white,
37
41
  transition: 'box-shadow 150ms ease',
38
42
  zIndex: 12, // skeleton is 11
43
+ '& tr th:first-child div': {
44
+ paddingLeft: theme.spacing.md,
45
+ },
39
46
 
40
47
  '&::after': {
41
48
  content: '""',
@@ -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(
@@ -22,7 +22,8 @@ describe('Table.Filter', () => {
22
22
  expect(screen.getByPlaceholderText('hello fruits')).toBeVisible();
23
23
  });
24
24
 
25
- it('calls onChange when typing something in the filter', () => {
25
+ it('calls onChange when typing something in the filter', async () => {
26
+ const user = userEvent.setup({delay: null});
26
27
  const onChange = jest.fn();
27
28
  render(
28
29
  <Table data={[{name: 'fruit'}, {name: 'vegetable'}]} columns={columns} onChange={onChange}>
@@ -32,7 +33,7 @@ describe('Table.Filter', () => {
32
33
  </Table>
33
34
  );
34
35
 
35
- userEvent.type(screen.getByRole('textbox'), 'vegetable');
36
+ await user.type(screen.getByRole('textbox'), 'vegetable');
36
37
 
37
38
  expect(onChange).toHaveBeenCalledWith(expect.objectContaining({globalFilter: 'vegetable'}));
38
39
  });
@@ -62,7 +62,8 @@ describe('Table.PerPage', () => {
62
62
  );
63
63
  });
64
64
 
65
- it('calls onChange when changing the number of items per page', () => {
65
+ it('calls onChange when changing the number of items per page', async () => {
66
+ const user = userEvent.setup({delay: null});
66
67
  const onChange = jest.fn();
67
68
  render(
68
69
  <Table data={[{name: 'fruit'}, {name: 'vegetable'}]} columns={columns} onChange={onChange}>
@@ -72,7 +73,7 @@ describe('Table.PerPage', () => {
72
73
  </Table>
73
74
  );
74
75
 
75
- userEvent.click(screen.queryByRole('radio', {name: '100'}));
76
+ await user.click(screen.queryByRole('radio', {name: '100'}));
76
77
 
77
78
  expect(onChange).toHaveBeenCalledWith(
78
79
  expect.objectContaining({pagination: expect.objectContaining({pageSize: 100})})
@@ -69,6 +69,7 @@ describe('Table.Predicate', () => {
69
69
  });
70
70
 
71
71
  it('calls onChange when changing the predicate', async () => {
72
+ const user = userEvent.setup({delay: null});
72
73
  const onChange = jest.fn();
73
74
  render(
74
75
  <Table
@@ -97,13 +98,13 @@ describe('Table.Predicate', () => {
97
98
  ).toHaveValue('Second');
98
99
  });
99
100
 
100
- userEvent.click(
101
+ await user.click(
101
102
  screen.getByRole('searchbox', {
102
103
  name: 'rank',
103
104
  })
104
105
  );
105
106
 
106
- userEvent.click(
107
+ await user.click(
107
108
  screen.getByRole('option', {
108
109
  name: 'First',
109
110
  })