@transferwise/components 0.0.0-experimental-029bd71 → 0.0.0-experimental-339e531
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/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/i18n/en.json +0 -5
- package/build/i18n/en.json.js +0 -5
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +0 -5
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/main.css +0 -300
- package/build/styles/main.css +0 -300
- package/build/types/button/Button.d.ts +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
- package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +158 -0
- package/build/types/test-utils/index.d.ts.map +1 -0
- package/build/types/test-utils/jest.setup.d.ts +2 -0
- package/build/types/test-utils/jest.setup.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/button/{Button.spec.js → Button.spec.tsx} +3 -2
- package/src/button/Button.tsx +1 -1
- package/src/button/legacyUtils/{legacyUtils.spec.js → legacyUtils.spec.tsx} +1 -1
- package/src/button/legacyUtils/legacyUtils.ts +2 -2
- package/src/i18n/en.json +0 -5
- package/src/main.css +0 -300
- package/src/main.less +0 -1
- package/src/modal/{Modal.rtl.spec.js → Modal.rtl.spec.tsx} +8 -7
- package/src/slidingPanel/SlidingPanel.spec.js +1 -1
- package/src/ssr.spec.tsx +264 -0
- package/src/test-utils/{index.js → index.tsx} +11 -6
- package/src/test-utils/{jest.setup.js → jest.setup.ts} +13 -8
- package/build/styles/table/Table.css +0 -300
- package/build/types/table/Table.d.ts +0 -23
- package/build/types/table/Table.d.ts.map +0 -1
- package/build/types/table/Table.messages.d.ts +0 -24
- package/build/types/table/Table.messages.d.ts.map +0 -1
- package/build/types/table/TableCell.d.ts +0 -44
- package/build/types/table/TableCell.d.ts.map +0 -1
- package/build/types/table/TableHeader.d.ts +0 -13
- package/build/types/table/TableHeader.d.ts.map +0 -1
- package/build/types/table/TableRow.d.ts +0 -17
- package/build/types/table/TableRow.d.ts.map +0 -1
- package/build/types/table/TableStatusText.d.ts +0 -9
- package/build/types/table/TableStatusText.d.ts.map +0 -1
- package/build/types/table/index.d.ts +0 -6
- package/build/types/table/index.d.ts.map +0 -1
- package/src/ssr.spec.js +0 -256
- package/src/table/Table.css +0 -300
- package/src/table/Table.less +0 -361
- package/src/table/Table.messages.ts +0 -24
- package/src/table/Table.spec.tsx +0 -88
- package/src/table/Table.story.tsx +0 -359
- package/src/table/Table.tsx +0 -166
- package/src/table/TableCell.spec.tsx +0 -304
- package/src/table/TableCell.tsx +0 -170
- package/src/table/TableHeader.spec.tsx +0 -55
- package/src/table/TableHeader.tsx +0 -75
- package/src/table/TableRow.spec.tsx +0 -117
- package/src/table/TableRow.tsx +0 -70
- package/src/table/TableStatusText.spec.tsx +0 -53
- package/src/table/TableStatusText.tsx +0 -36
- package/src/table/index.ts +0 -11
- /package/src/button/__snapshots__/{Button.spec.js.snap → Button.spec.tsx.snap} +0 -0
- /package/src/dimmer/{Dimmer.rtl.spec.js → Dimmer.rtl.spec.tsx} +0 -0
- /package/src/info/{Info.spec.js → Info.spec.jsx} +0 -0
package/src/table/Table.less
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
@import (reference) "../../node_modules/@transferwise/neptune-css/src/variables/legacy-variables.less";
|
|
2
|
-
@import (reference) "../../node_modules/@transferwise/neptune-css/src/less/ring.less";
|
|
3
|
-
|
|
4
|
-
.np-table {
|
|
5
|
-
@table-background-color: var(--color-background-neutral);
|
|
6
|
-
@table-border-width: var(--size-8);
|
|
7
|
-
@table-border-radius: var(--radius-small);
|
|
8
|
-
@table-border-radius: var(--radius-medium);
|
|
9
|
-
@table-inner-border-radius: 10px;
|
|
10
|
-
@table-cell-border-radius: 6px;
|
|
11
|
-
|
|
12
|
-
@table-spacing-sm: var(--size-4);
|
|
13
|
-
@table-spacing-md: var(--size-8);
|
|
14
|
-
@table-spacing-lg: var(--size-12);
|
|
15
|
-
@table-spacing-xl: var(--size-16);
|
|
16
|
-
|
|
17
|
-
@header-min-width: 160px;
|
|
18
|
-
@header-min-width-loading: calc(@header-min-width * 2);
|
|
19
|
-
|
|
20
|
-
width: 100%;
|
|
21
|
-
background-color: transparent;
|
|
22
|
-
|
|
23
|
-
&-outer-container {
|
|
24
|
-
border-radius: @table-border-radius;
|
|
25
|
-
|
|
26
|
-
.focus-ring();
|
|
27
|
-
&:focus-visible {
|
|
28
|
-
outline-offset: 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&--center {
|
|
32
|
-
margin-right: auto;
|
|
33
|
-
margin-left: auto;
|
|
34
|
-
|
|
35
|
-
@media (max-width: @screen-sm-max) {
|
|
36
|
-
width: 100%;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&--full-width {
|
|
41
|
-
width: 100%;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&-container {
|
|
46
|
-
padding: @table-spacing-md;
|
|
47
|
-
background-color: @table-background-color;
|
|
48
|
-
border-radius: inherit;
|
|
49
|
-
|
|
50
|
-
&--loading {
|
|
51
|
-
.np-table-inner-container {
|
|
52
|
-
background-image: none;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&-inner-container {
|
|
58
|
-
background-image:
|
|
59
|
-
linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)),
|
|
60
|
-
linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)),
|
|
61
|
-
linear-gradient(to right, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0)),
|
|
62
|
-
linear-gradient(to left, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0));
|
|
63
|
-
background-position: left center, right center, left center, right center;
|
|
64
|
-
background-repeat: no-repeat;
|
|
65
|
-
background-color: var(--color-contrast-overlay);
|
|
66
|
-
background-size: 15px 100%, 15px 100%, 15px 100%, 15px 100%;
|
|
67
|
-
background-attachment: local, local, scroll, scroll;
|
|
68
|
-
overflow-x: auto;
|
|
69
|
-
border-radius: @table-inner-border-radius;
|
|
70
|
-
|
|
71
|
-
.np-theme-personal--dark & {
|
|
72
|
-
background-image:
|
|
73
|
-
linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)),
|
|
74
|
-
linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)),
|
|
75
|
-
linear-gradient(to right, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0)),
|
|
76
|
-
linear-gradient(to left, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&-row {
|
|
81
|
-
&:last-child {
|
|
82
|
-
.np-table-cell {
|
|
83
|
-
&:first-child {
|
|
84
|
-
border-bottom-left-radius: @table-inner-border-radius;
|
|
85
|
-
}
|
|
86
|
-
&:last-child {
|
|
87
|
-
border-bottom-right-radius: @table-inner-border-radius;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.focus-ring();
|
|
93
|
-
&:focus-visible {
|
|
94
|
-
outline-offset: -2px;
|
|
95
|
-
border-radius: @table-cell-border-radius;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
&--clickable {
|
|
99
|
-
.np-table-cell {
|
|
100
|
-
position: relative;
|
|
101
|
-
&:before {
|
|
102
|
-
display: none;
|
|
103
|
-
content: "";
|
|
104
|
-
position: absolute;
|
|
105
|
-
height: 100%;
|
|
106
|
-
width: 100%;
|
|
107
|
-
top: 0;
|
|
108
|
-
left: 0;
|
|
109
|
-
background-color: var(--color-background-screen-hover);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
&:first-child,
|
|
113
|
-
&:last-child {
|
|
114
|
-
&:before {
|
|
115
|
-
width: calc(100% - @table-spacing-md);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
&:first-child {
|
|
120
|
-
&:before {
|
|
121
|
-
left: @table-spacing-md;
|
|
122
|
-
border-top-left-radius: @table-cell-border-radius;
|
|
123
|
-
border-bottom-left-radius: @table-cell-border-radius;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&:last-child {
|
|
128
|
-
&:before {
|
|
129
|
-
border-top-right-radius: @table-cell-border-radius;
|
|
130
|
-
border-bottom-right-radius: @table-cell-border-radius;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&:hover {
|
|
136
|
-
.np-table-cell:before {
|
|
137
|
-
display: block;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
&:focus-visible {
|
|
141
|
-
.np-table-cell {
|
|
142
|
-
&:first-child,
|
|
143
|
-
&:last-child {
|
|
144
|
-
&:before {
|
|
145
|
-
width: 100%;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
&:first-child {
|
|
150
|
-
&:before {
|
|
151
|
-
left: 0;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
&--cosmetic {
|
|
160
|
-
.np-table-cell {
|
|
161
|
-
height: @table-spacing-md;
|
|
162
|
-
padding: 0;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
&-header,
|
|
168
|
-
&-cell {
|
|
169
|
-
padding: 0;
|
|
170
|
-
|
|
171
|
-
&:first-child {
|
|
172
|
-
padding-left: @table-spacing-xl;
|
|
173
|
-
|
|
174
|
-
.np-table-header-content,
|
|
175
|
-
.np-table-cell-content {
|
|
176
|
-
padding-left: 0;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&:last-child {
|
|
181
|
-
padding-right: @table-spacing-xl;
|
|
182
|
-
|
|
183
|
-
.np-table-header-content,
|
|
184
|
-
.np-table-cell-content {
|
|
185
|
-
padding-right: 0;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.np-table-text-secondary {
|
|
190
|
-
color: var(--color-content-tertiary);
|
|
191
|
-
font-size: var(--font-size-12);
|
|
192
|
-
font-style: normal;
|
|
193
|
-
font-weight: var(--font-weight-regular);
|
|
194
|
-
line-height: var(--line-height-18);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
&-header.np-table-header--right,
|
|
199
|
-
&-cell.np-table-cell--right {
|
|
200
|
-
> .np-text-body-default {
|
|
201
|
-
text-align: right;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
&-header.np-table-header--right + .np-table-header:not(.np-table-header--right),
|
|
206
|
-
&-cell.np-table-cell--right + .np-table-cell:not(.np-table-cell--right) {
|
|
207
|
-
padding-left: calc(@table-spacing-md + @table-spacing-lg);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
&-header.np-table-header--right .np-table-header-content,
|
|
211
|
-
&-cell.np-table-cell--right .np-table-content {
|
|
212
|
-
justify-content: end;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
&-header-content,
|
|
216
|
-
&-content {
|
|
217
|
-
display: flex;
|
|
218
|
-
align-items: center;
|
|
219
|
-
justify-content: start;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
&-header {
|
|
223
|
-
min-width: @header-min-width;
|
|
224
|
-
padding-right: @table-spacing-md;
|
|
225
|
-
padding-bottom: @table-spacing-md;
|
|
226
|
-
padding-left: @table-spacing-md;
|
|
227
|
-
background-color: var(--color-background-neutral);
|
|
228
|
-
color: var(--color-interactive-primary);
|
|
229
|
-
|
|
230
|
-
&-content {
|
|
231
|
-
padding-top: 5px;
|
|
232
|
-
padding-bottom: 5px;
|
|
233
|
-
white-space: nowrap;
|
|
234
|
-
line-height: var(--line-height-22);
|
|
235
|
-
letter-spacing: var(--letter-spacing-sm);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
&--error {
|
|
239
|
-
color: var(--color-sentiment-negative);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
&--action {
|
|
243
|
-
min-width: 0;
|
|
244
|
-
padding: 0;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
&-cell {
|
|
249
|
-
padding: @table-spacing-xl @table-spacing-md;
|
|
250
|
-
position: relative;
|
|
251
|
-
|
|
252
|
-
&--cosmetic {
|
|
253
|
-
padding: 0;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
&--primary {
|
|
257
|
-
min-width: 200px;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
&--currency {
|
|
261
|
-
.np-text-body-default {
|
|
262
|
-
white-space: nowrap;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// TODO: In next iterations this block of code should be removed after we'll have `24px` status icons
|
|
267
|
-
&--status {
|
|
268
|
-
.status-circle {
|
|
269
|
-
width: 24px;
|
|
270
|
-
height: 24px;
|
|
271
|
-
|
|
272
|
-
.status-icon > svg {
|
|
273
|
-
width: 21px;
|
|
274
|
-
height: 21px;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.tw-chevron {
|
|
280
|
-
margin-left: @table-spacing-md;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
&-separator {
|
|
284
|
-
margin-top: @table-spacing-sm;
|
|
285
|
-
margin-bottom: @table-spacing-sm;
|
|
286
|
-
height: 1px;
|
|
287
|
-
background-color: @table-background-color;
|
|
288
|
-
padding: 0;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.np-text-body-default {
|
|
292
|
-
line-height: var(--line-height-22);
|
|
293
|
-
letter-spacing: var(--letter-spacing-xs);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
.np-text-body-default-bold {
|
|
297
|
-
display: flex;
|
|
298
|
-
align-items: center;
|
|
299
|
-
color: var(--color-content-primary);
|
|
300
|
-
white-space: nowrap;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.np-table-content--success {
|
|
304
|
-
color: var(--color-sentiment-positive);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.np-table-content--error {
|
|
308
|
-
color: var(--color-sentiment-negative);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.tw-loader {
|
|
312
|
-
// The loading area of the table should equals to 5 rows of the table for huge screens and 3 rows for small screens
|
|
313
|
-
margin: 150px auto;
|
|
314
|
-
@media (--screen-400-zoom) {
|
|
315
|
-
margin-top: 70px;
|
|
316
|
-
margin-bottom: 70px;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
&-content {
|
|
322
|
-
gap: @table-spacing-lg;
|
|
323
|
-
|
|
324
|
-
&--success,
|
|
325
|
-
&--error {
|
|
326
|
-
gap: @table-spacing-sm;
|
|
327
|
-
|
|
328
|
-
.np-table-content-text {
|
|
329
|
-
line-height: 155%;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
&-media {
|
|
334
|
-
flex-shrink: 0;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
&-body {
|
|
338
|
-
display: flex;
|
|
339
|
-
flex-direction: column;
|
|
340
|
-
font-size: var(--font-size-12);
|
|
341
|
-
color: var(--color-content-tertiary);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
&--reversed {
|
|
345
|
-
flex-direction: row-reverse;
|
|
346
|
-
|
|
347
|
-
.np-table-content-body {
|
|
348
|
-
align-items: end;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
&-empty-data {
|
|
354
|
-
display: flex;
|
|
355
|
-
align-items: center;
|
|
356
|
-
|
|
357
|
-
.status-circle {
|
|
358
|
-
margin-right: @table-spacing-lg;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
|
|
3
|
-
export default defineMessages({
|
|
4
|
-
loading: {
|
|
5
|
-
id: 'neptune.Table.loading',
|
|
6
|
-
defaultMessage: 'Table data is loading',
|
|
7
|
-
},
|
|
8
|
-
loaded: {
|
|
9
|
-
id: 'neptune.Table.loaded',
|
|
10
|
-
defaultMessage: 'Table data is loaded',
|
|
11
|
-
},
|
|
12
|
-
emptyData: {
|
|
13
|
-
id: 'neptune.Table.emptyData',
|
|
14
|
-
defaultMessage: 'No results found',
|
|
15
|
-
},
|
|
16
|
-
refreshPage: {
|
|
17
|
-
id: 'neptune.Table.refreshPage',
|
|
18
|
-
defaultMessage: 'Refresh page',
|
|
19
|
-
},
|
|
20
|
-
actionHeader: {
|
|
21
|
-
id: 'neptune.Table.actionHeader',
|
|
22
|
-
defaultMessage: 'Action',
|
|
23
|
-
},
|
|
24
|
-
});
|
package/src/table/Table.spec.tsx
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { userEvent } from '@testing-library/user-event';
|
|
4
|
-
import '@testing-library/jest-dom';
|
|
5
|
-
import { IntlProvider } from 'react-intl';
|
|
6
|
-
import Table, { TableProps } from './Table';
|
|
7
|
-
import { mockMatchMedia } from '../test-utils';
|
|
8
|
-
|
|
9
|
-
mockMatchMedia();
|
|
10
|
-
|
|
11
|
-
const renderWithIntl = (component: React.ReactNode) => {
|
|
12
|
-
return render(<IntlProvider locale="en">{component}</IntlProvider>);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
describe('Table Component', () => {
|
|
16
|
-
const defaultProps: TableProps = {
|
|
17
|
-
data: {
|
|
18
|
-
headers: [{ header: 'Header 1' }, { header: 'Header 2' }],
|
|
19
|
-
rows: [
|
|
20
|
-
{
|
|
21
|
-
cells: [
|
|
22
|
-
{ cell: { type: 'text', text: 'Cell content 1' } },
|
|
23
|
-
{ cell: { type: 'text', text: 'Cell content 2' } },
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
cells: [
|
|
28
|
-
{ cell: { type: 'text', text: 'Cell content 3' } },
|
|
29
|
-
{ cell: { type: 'text', text: 'Cell content 4' } },
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
onRowClick: jest.fn(),
|
|
34
|
-
},
|
|
35
|
-
loading: false,
|
|
36
|
-
className: '',
|
|
37
|
-
fullWidth: true,
|
|
38
|
-
error: undefined,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
it('renders table', () => {
|
|
42
|
-
renderWithIntl(<Table {...defaultProps} />);
|
|
43
|
-
expect(screen.getByText('Header 1')).toBeInTheDocument();
|
|
44
|
-
expect(screen.getByText('Header 2')).toBeInTheDocument();
|
|
45
|
-
expect(screen.getByText('Cell content 1')).toBeInTheDocument();
|
|
46
|
-
expect(screen.getByText('Cell content 2')).toBeInTheDocument();
|
|
47
|
-
expect(screen.getByText('Cell content 3')).toBeInTheDocument();
|
|
48
|
-
expect(screen.getByText('Cell content 4')).toBeInTheDocument();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('renders `loading` state on loading', () => {
|
|
52
|
-
renderWithIntl(<Table {...defaultProps} loading />);
|
|
53
|
-
expect(screen.getAllByTestId('np-table-loader')).toHaveLength(1);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('renders `empty data` message for empty table`s data', () => {
|
|
57
|
-
renderWithIntl(<Table {...defaultProps} data={{ headers: [], rows: [] }} />);
|
|
58
|
-
expect(screen.getAllByTestId('np-table-empty-data')).toHaveLength(1);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('renders `error` message if `error` is passed', () => {
|
|
62
|
-
const errorProps: TableProps = {
|
|
63
|
-
...defaultProps,
|
|
64
|
-
error: { message: 'Error occurred', action: { text: 'Retry' } },
|
|
65
|
-
};
|
|
66
|
-
renderWithIntl(<Table {...errorProps} />);
|
|
67
|
-
expect(screen.getByText('Error occurred')).toBeInTheDocument();
|
|
68
|
-
expect(screen.getByText('Retry')).toBeInTheDocument();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('renders with custom class name', () => {
|
|
72
|
-
renderWithIntl(<Table {...defaultProps} className="custom-class" />);
|
|
73
|
-
expect(screen.getByTestId('np-table-outer-container')).toHaveClass('custom-class');
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('renders with `fullWidth` set to false', () => {
|
|
77
|
-
renderWithIntl(<Table {...defaultProps} fullWidth={false} />);
|
|
78
|
-
expect(screen.getByTestId('np-table-outer-container')).toHaveClass(
|
|
79
|
-
'np-table-outer-container--center',
|
|
80
|
-
);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('calls `onRowClick` when a row is clicked', async () => {
|
|
84
|
-
renderWithIntl(<Table {...defaultProps} />);
|
|
85
|
-
await userEvent.click(screen.getByText('Cell content 1'));
|
|
86
|
-
expect(defaultProps.data.onRowClick).toHaveBeenCalled();
|
|
87
|
-
});
|
|
88
|
-
});
|