@atlaskit/button 17.17.2 → 17.17.3
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/CHANGELOG.md +10 -1
- package/__perf__/button.tsx +6 -6
- package/__perf__/custom.tsx +6 -6
- package/__perf__/customised.tsx +1 -3
- package/__perf__/utils/example-runner.tsx +32 -36
- package/__perf__/utils/interaction-tasks.tsx +65 -86
- package/codemods/15.0.0-lite-mode.tsx +32 -36
- package/codemods/15.1.1-data-testid.tsx +136 -142
- package/codemods/__tests__/15.0.0-lite-mode/optimistic.tsx +121 -121
- package/codemods/__tests__/15.0.0-lite-mode/safe.tsx +54 -54
- package/codemods/__tests__/15.0.0-lite-mode/shared.tsx +96 -97
- package/codemods/__tests__/15.1.1-data-testid/rename-data-testid.tsx +32 -32
- package/codemods/__tests__/_framework.tsx +32 -32
- package/codemods/helpers/15.0.0-runner.tsx +135 -137
- package/codemods/helpers/helpers-generic.tsx +524 -556
- package/codemods/optimistic-15.0.0-lite-mode.tsx +208 -231
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/variants/default/link.js +2 -2
- package/dist/es2019/new-button/variants/icon/link.js +3 -3
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/variants/default/link.js +2 -2
- package/dist/esm/new-button/variants/icon/link.js +3 -3
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/entry-points/loading-button.d.ts +1 -1
- package/dist/types/entry-points/new.d.ts +3 -3
- package/dist/types/entry-points/types.d.ts +2 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/new.d.ts +3 -3
- package/dist/types-ts4.5/entry-points/loading-button.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/new.d.ts +3 -3
- package/dist/types-ts4.5/entry-points/types.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +3 -3
- package/dist/types-ts4.5/new.d.ts +3 -3
- package/extract-react-types/custom-theme-button-props.tsx +2 -4
- package/extract-react-types/legacy-button/custom-theme-button-props.tsx +2 -4
- package/extract-react-types/legacy-button/loading-button-props.tsx +1 -1
- package/extract-react-types/legacy-button/shared-props.tsx +1 -1
- package/extract-react-types/loading-button-props.tsx +1 -1
- package/extract-react-types/new-button/containers/split-button/split-button-props.tsx +1 -1
- package/extract-react-types/new-button/variants/default/button-props.tsx +1 -1
- package/extract-react-types/new-button/variants/default/common-default-button-props.tsx +4 -4
- package/extract-react-types/new-button/variants/default/link-button-props.tsx +4 -4
- package/extract-react-types/new-button/variants/icon-button/common-icon-button-props.tsx +4 -4
- package/extract-react-types/new-button/variants/icon-button/icon-button-props.tsx +1 -1
- package/extract-react-types/new-button/variants/icon-button/link-icon-button-props.tsx +2 -4
- package/extract-react-types/shared-props.tsx +1 -1
- package/package.json +2 -2
- package/report.api.md +78 -96
|
@@ -4,10 +4,10 @@ import transformer from '../../optimistic-15.0.0-lite-mode';
|
|
|
4
4
|
import { check } from '../_framework';
|
|
5
5
|
|
|
6
6
|
describe('Change `type ButtonAppearances` to `type Appearance`', () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
check({
|
|
8
|
+
transformer,
|
|
9
|
+
it: 'should separate types into a different export from the components',
|
|
10
|
+
original: `
|
|
11
11
|
import Button, { ButtonAppearances } from '@atlaskit/button';
|
|
12
12
|
|
|
13
13
|
export type Mine = ButtonAppearances & 'purple';
|
|
@@ -18,7 +18,7 @@ describe('Change `type ButtonAppearances` to `type Appearance`', () => {
|
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
`,
|
|
21
|
-
|
|
21
|
+
expected: `
|
|
22
22
|
import { Appearance } from '@atlaskit/button/types';
|
|
23
23
|
import Button from '@atlaskit/button/standard-button';
|
|
24
24
|
|
|
@@ -28,14 +28,14 @@ describe('Change `type ButtonAppearances` to `type Appearance`', () => {
|
|
|
28
28
|
return <Button onClick={() => console.log('hi')}>standard button</Button>;
|
|
29
29
|
}
|
|
30
30
|
`,
|
|
31
|
-
|
|
31
|
+
});
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
describe('Changing <Button /> usage', () => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
check({
|
|
36
|
+
transformer,
|
|
37
|
+
it: 'should move to standard button',
|
|
38
|
+
original: `
|
|
39
39
|
import React from 'react';
|
|
40
40
|
import Button from '@atlaskit/button';
|
|
41
41
|
|
|
@@ -45,7 +45,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
`,
|
|
48
|
-
|
|
48
|
+
expected: `
|
|
49
49
|
import React from 'react';
|
|
50
50
|
import Button from '@atlaskit/button/standard-button';
|
|
51
51
|
|
|
@@ -53,12 +53,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
53
53
|
return <Button onClick={() => console.log('hi')}>standard button</Button>;
|
|
54
54
|
}
|
|
55
55
|
`,
|
|
56
|
-
|
|
56
|
+
});
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
check({
|
|
59
|
+
transformer,
|
|
60
|
+
it: 'should move to standard button (self closing button)',
|
|
61
|
+
original: `
|
|
62
62
|
import React from 'react';
|
|
63
63
|
import Button from '@atlaskit/button';
|
|
64
64
|
|
|
@@ -66,7 +66,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
66
66
|
return <Button onClick={() => console.log('hi')} />;
|
|
67
67
|
}
|
|
68
68
|
`,
|
|
69
|
-
|
|
69
|
+
expected: `
|
|
70
70
|
import React from 'react';
|
|
71
71
|
import Button from '@atlaskit/button/standard-button';
|
|
72
72
|
|
|
@@ -74,12 +74,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
74
74
|
return <Button onClick={() => console.log('hi')} />;
|
|
75
75
|
}
|
|
76
76
|
`,
|
|
77
|
-
|
|
77
|
+
});
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
check({
|
|
80
|
+
transformer,
|
|
81
|
+
it: 'should move to standard button (when fallback is needed)',
|
|
82
|
+
original: `
|
|
83
83
|
import React from 'react';
|
|
84
84
|
import Button from './our-button';
|
|
85
85
|
import AkButton from '@atlaskit/button';
|
|
@@ -93,7 +93,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
`,
|
|
96
|
-
|
|
96
|
+
expected: `
|
|
97
97
|
import React from 'react';
|
|
98
98
|
import Button from './our-button';
|
|
99
99
|
import DSButton from '@atlaskit/button/standard-button';
|
|
@@ -105,12 +105,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
105
105
|
</>;
|
|
106
106
|
}
|
|
107
107
|
`,
|
|
108
|
-
|
|
108
|
+
});
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
check({
|
|
111
|
+
transformer,
|
|
112
|
+
it: 'should move to loading button',
|
|
113
|
+
original: `
|
|
114
114
|
import React from 'react';
|
|
115
115
|
import Button from '@atlaskit/button';
|
|
116
116
|
import { getIsLoading } from './get-is-loading';
|
|
@@ -124,7 +124,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
`,
|
|
127
|
-
|
|
127
|
+
expected: `
|
|
128
128
|
import React from 'react';
|
|
129
129
|
import LoadingButton from '@atlaskit/button/loading-button';
|
|
130
130
|
import { getIsLoading } from './get-is-loading';
|
|
@@ -136,12 +136,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
136
136
|
</>;
|
|
137
137
|
}
|
|
138
138
|
`,
|
|
139
|
-
|
|
139
|
+
});
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
check({
|
|
142
|
+
transformer,
|
|
143
|
+
it: 'should move to loading button (when fallback is needed)',
|
|
144
|
+
original: `
|
|
145
145
|
import React from 'react';
|
|
146
146
|
import Button from '@atlaskit/button';
|
|
147
147
|
import LoadingButton from './our-buttons';
|
|
@@ -154,7 +154,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
156
|
`,
|
|
157
|
-
|
|
157
|
+
expected: `
|
|
158
158
|
import React from 'react';
|
|
159
159
|
import DSLoadingButton from '@atlaskit/button/loading-button';
|
|
160
160
|
import LoadingButton from './our-buttons';
|
|
@@ -165,12 +165,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
165
165
|
</>;
|
|
166
166
|
}
|
|
167
167
|
`,
|
|
168
|
-
|
|
168
|
+
});
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
170
|
+
check({
|
|
171
|
+
transformer,
|
|
172
|
+
it: 'should move to custom theme button',
|
|
173
|
+
original: `
|
|
174
174
|
import React from 'react';
|
|
175
175
|
import Button from '@atlaskit/button';
|
|
176
176
|
import { customTheme } from './theme';
|
|
@@ -184,7 +184,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
`,
|
|
187
|
-
|
|
187
|
+
expected: `
|
|
188
188
|
import React from 'react';
|
|
189
189
|
import CustomThemeButton from '@atlaskit/button/custom-theme-button';
|
|
190
190
|
import { customTheme } from './theme';
|
|
@@ -196,12 +196,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
196
196
|
</>;
|
|
197
197
|
}
|
|
198
198
|
`,
|
|
199
|
-
|
|
199
|
+
});
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
check({
|
|
202
|
+
transformer,
|
|
203
|
+
it: 'should move to custom theme button (when fallback is needed)',
|
|
204
|
+
original: `
|
|
205
205
|
import React from 'react';
|
|
206
206
|
import Button from '@atlaskit/button';
|
|
207
207
|
import { customTheme } from './theme';
|
|
@@ -217,7 +217,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
219
|
`,
|
|
220
|
-
|
|
220
|
+
expected: `
|
|
221
221
|
import React from 'react';
|
|
222
222
|
import DSCustomThemeButton from '@atlaskit/button/custom-theme-button';
|
|
223
223
|
import { customTheme } from './theme';
|
|
@@ -231,12 +231,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
231
231
|
</>;
|
|
232
232
|
}
|
|
233
233
|
`,
|
|
234
|
-
|
|
234
|
+
});
|
|
235
235
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
check({
|
|
237
|
+
transformer,
|
|
238
|
+
it: 'should use CustomThemeButton in a file that uses Theme',
|
|
239
|
+
original: `
|
|
240
240
|
import React from 'react';
|
|
241
241
|
import Button, { Theme } from '@atlaskit/button';
|
|
242
242
|
import { customTheme } from './custom-theme';
|
|
@@ -250,7 +250,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
250
250
|
</>
|
|
251
251
|
}
|
|
252
252
|
`,
|
|
253
|
-
|
|
253
|
+
expected: `
|
|
254
254
|
/* TODO: (from codemod) Using "import { Theme } from '@atlaskit/button/custom-theme-button" in a file
|
|
255
255
|
will cause all buttons in that file to be safely converted to a <CustomThemeButton/> */
|
|
256
256
|
import React from 'react';
|
|
@@ -266,12 +266,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
266
266
|
</>;
|
|
267
267
|
}
|
|
268
268
|
`,
|
|
269
|
-
|
|
269
|
+
});
|
|
270
270
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
271
|
+
check({
|
|
272
|
+
transformer,
|
|
273
|
+
it: 'should move to the correct button for prop usages',
|
|
274
|
+
original: `
|
|
275
275
|
import React from 'react';
|
|
276
276
|
import Button from '@atlaskit/button';
|
|
277
277
|
import { getIsLoading, customTheme } from './util';
|
|
@@ -287,7 +287,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
287
287
|
);
|
|
288
288
|
}
|
|
289
289
|
`,
|
|
290
|
-
|
|
290
|
+
expected: `
|
|
291
291
|
import React from 'react';
|
|
292
292
|
import Button from '@atlaskit/button/standard-button';
|
|
293
293
|
import LoadingButton from '@atlaskit/button/loading-button';
|
|
@@ -303,12 +303,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
303
303
|
</>;
|
|
304
304
|
}
|
|
305
305
|
`,
|
|
306
|
-
|
|
306
|
+
});
|
|
307
307
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
check({
|
|
309
|
+
transformer,
|
|
310
|
+
it: 'should move to the correct button for prop usages (with fallbacks)',
|
|
311
|
+
original: `
|
|
312
312
|
import React from 'react';
|
|
313
313
|
import AkButton from '@atlaskit/button';
|
|
314
314
|
import { getIsLoading, customTheme } from './util';
|
|
@@ -325,7 +325,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
325
325
|
);
|
|
326
326
|
}
|
|
327
327
|
`,
|
|
328
|
-
|
|
328
|
+
expected: `
|
|
329
329
|
import React from 'react';
|
|
330
330
|
import DSButton from '@atlaskit/button/standard-button';
|
|
331
331
|
import DSLoadingButton from '@atlaskit/button/loading-button';
|
|
@@ -342,19 +342,19 @@ describe('Changing <Button /> usage', () => {
|
|
|
342
342
|
</>;
|
|
343
343
|
}
|
|
344
344
|
`,
|
|
345
|
-
|
|
345
|
+
});
|
|
346
346
|
});
|
|
347
347
|
|
|
348
348
|
describe('Non exclusive JSX usage of <Button />', () => {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
349
|
+
check({
|
|
350
|
+
transformer,
|
|
351
|
+
it: 'should use standard button if Button is not used in JSX',
|
|
352
|
+
original: `
|
|
353
353
|
import AkButton from '@atlaskit/button';
|
|
354
354
|
|
|
355
355
|
export default { button: AkButton };
|
|
356
356
|
`,
|
|
357
|
-
|
|
357
|
+
expected: `
|
|
358
358
|
/* TODO: (from codemod) This file does not exclusively use Button in JSX.
|
|
359
359
|
The codemod is unable to know which button variant, so it is using
|
|
360
360
|
the standard button: "@atlaskit/button/standard-button".
|
|
@@ -365,12 +365,12 @@ describe('Non exclusive JSX usage of <Button />', () => {
|
|
|
365
365
|
|
|
366
366
|
export default { button: AkButton };
|
|
367
367
|
`,
|
|
368
|
-
|
|
368
|
+
});
|
|
369
369
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
check({
|
|
371
|
+
transformer,
|
|
372
|
+
it: 'should use standard button if Button is used in JSX and also not in JSX',
|
|
373
|
+
original: `
|
|
374
374
|
import React from 'react';
|
|
375
375
|
import Button from './our-button';
|
|
376
376
|
import AkButton from '@atlaskit/button';
|
|
@@ -388,7 +388,7 @@ describe('Non exclusive JSX usage of <Button />', () => {
|
|
|
388
388
|
// Not used in JSX
|
|
389
389
|
expect(AkButton).toBe(true);
|
|
390
390
|
`,
|
|
391
|
-
|
|
391
|
+
expected: `
|
|
392
392
|
import React from 'react';
|
|
393
393
|
import Button from './our-button';
|
|
394
394
|
/* TODO: (from codemod) This file does not exclusively use Button in JSX.
|
|
@@ -412,14 +412,14 @@ describe('Non exclusive JSX usage of <Button />', () => {
|
|
|
412
412
|
// Not used in JSX
|
|
413
413
|
expect(AkButton).toBe(true);
|
|
414
414
|
`,
|
|
415
|
-
|
|
415
|
+
});
|
|
416
416
|
});
|
|
417
417
|
|
|
418
418
|
describe('Spreading props', () => {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
419
|
+
check({
|
|
420
|
+
transformer,
|
|
421
|
+
it: 'should try to choose the right button if there are locally spread values (seperate object)',
|
|
422
|
+
original: `
|
|
423
423
|
import React from 'react';
|
|
424
424
|
import Button from '@atlaskit/button';
|
|
425
425
|
|
|
@@ -433,7 +433,7 @@ describe('Spreading props', () => {
|
|
|
433
433
|
);
|
|
434
434
|
}
|
|
435
435
|
`,
|
|
436
|
-
|
|
436
|
+
expected: `
|
|
437
437
|
import React from 'react';
|
|
438
438
|
import LoadingButton from '@atlaskit/button/loading-button';
|
|
439
439
|
|
|
@@ -445,12 +445,12 @@ describe('Spreading props', () => {
|
|
|
445
445
|
return <LoadingButton {...props}>click me</LoadingButton>;
|
|
446
446
|
}
|
|
447
447
|
`,
|
|
448
|
-
|
|
448
|
+
});
|
|
449
449
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
450
|
+
check({
|
|
451
|
+
transformer,
|
|
452
|
+
it: 'should try to choose the right button if there are locally spread values (inline object)',
|
|
453
|
+
original: `
|
|
454
454
|
import React from 'react';
|
|
455
455
|
import Button from '@atlaskit/button';
|
|
456
456
|
|
|
@@ -460,7 +460,7 @@ describe('Spreading props', () => {
|
|
|
460
460
|
);
|
|
461
461
|
}
|
|
462
462
|
`,
|
|
463
|
-
|
|
463
|
+
expected: `
|
|
464
464
|
import React from 'react';
|
|
465
465
|
import LoadingButton from '@atlaskit/button/loading-button';
|
|
466
466
|
|
|
@@ -468,12 +468,12 @@ describe('Spreading props', () => {
|
|
|
468
468
|
return <LoadingButton {...({ isLoading: true })}>click me</LoadingButton>;
|
|
469
469
|
}
|
|
470
470
|
`,
|
|
471
|
-
|
|
471
|
+
});
|
|
472
472
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
473
|
+
check({
|
|
474
|
+
transformer,
|
|
475
|
+
it: 'should try to choose the right button if there are multiple local spread values',
|
|
476
|
+
original: `
|
|
477
477
|
import React from 'react';
|
|
478
478
|
import Button from '@atlaskit/button';
|
|
479
479
|
|
|
@@ -490,7 +490,7 @@ describe('Spreading props', () => {
|
|
|
490
490
|
);
|
|
491
491
|
}
|
|
492
492
|
`,
|
|
493
|
-
|
|
493
|
+
expected: `
|
|
494
494
|
import React from 'react';
|
|
495
495
|
import LoadingButton from '@atlaskit/button/loading-button';
|
|
496
496
|
|
|
@@ -505,12 +505,12 @@ describe('Spreading props', () => {
|
|
|
505
505
|
return <LoadingButton {...first} {...second}>click me</LoadingButton>;
|
|
506
506
|
}
|
|
507
507
|
`,
|
|
508
|
-
|
|
508
|
+
});
|
|
509
509
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
510
|
+
check({
|
|
511
|
+
transformer,
|
|
512
|
+
it: 'should try to choose the right button if there are locally spread values (custom theme button)',
|
|
513
|
+
original: `
|
|
514
514
|
import React from 'react';
|
|
515
515
|
import Button from '@atlaskit/button';
|
|
516
516
|
import { customTheme } from './our-theme';
|
|
@@ -526,7 +526,7 @@ describe('Spreading props', () => {
|
|
|
526
526
|
);
|
|
527
527
|
}
|
|
528
528
|
`,
|
|
529
|
-
|
|
529
|
+
expected: `
|
|
530
530
|
import React from 'react';
|
|
531
531
|
import CustomThemeButton from '@atlaskit/button/custom-theme-button';
|
|
532
532
|
import { customTheme } from './our-theme';
|
|
@@ -540,12 +540,12 @@ describe('Spreading props', () => {
|
|
|
540
540
|
return <CustomThemeButton {...props}>click me</CustomThemeButton>;
|
|
541
541
|
}
|
|
542
542
|
`,
|
|
543
|
-
|
|
543
|
+
});
|
|
544
544
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
545
|
+
check({
|
|
546
|
+
transformer,
|
|
547
|
+
it: 'should try to choose the right button if there is a spread value being mixed with a local values',
|
|
548
|
+
original: `
|
|
549
549
|
import React from 'react';
|
|
550
550
|
import Button from '@atlaskit/button';
|
|
551
551
|
import { customTheme } from './our-theme';
|
|
@@ -559,7 +559,7 @@ describe('Spreading props', () => {
|
|
|
559
559
|
);
|
|
560
560
|
}
|
|
561
561
|
`,
|
|
562
|
-
|
|
562
|
+
expected: `
|
|
563
563
|
import React from 'react';
|
|
564
564
|
import CustomThemeButton from '@atlaskit/button/custom-theme-button';
|
|
565
565
|
import { customTheme } from './our-theme';
|
|
@@ -571,13 +571,13 @@ describe('Spreading props', () => {
|
|
|
571
571
|
return <CustomThemeButton isLoading {...props}>click me</CustomThemeButton>;
|
|
572
572
|
}
|
|
573
573
|
`,
|
|
574
|
-
|
|
574
|
+
});
|
|
575
575
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
576
|
+
check({
|
|
577
|
+
transformer,
|
|
578
|
+
it: 'should fallback to CustomThemeButton if there is an unknown spread',
|
|
579
|
+
// ...itShouldLogWarning({ times: 2 }),
|
|
580
|
+
original: `
|
|
581
581
|
import React from 'react';
|
|
582
582
|
import Button from '@atlaskit/button';
|
|
583
583
|
import { getProps } from './get-props';
|
|
@@ -590,7 +590,7 @@ describe('Spreading props', () => {
|
|
|
590
590
|
return <Button {...getProps()}>click me</Button>;
|
|
591
591
|
}
|
|
592
592
|
`,
|
|
593
|
-
|
|
593
|
+
expected: `
|
|
594
594
|
/* TODO: (from codemod) Detected spreading props (<Button {...props} />) that was too complex for our codemod to understand
|
|
595
595
|
Our codemod will only look at inline objects, or objects defined in the same file (ObjectExpression's)
|
|
596
596
|
We have opted for our safest upgrade component in this file: '<CustomThemeButton />' */
|
|
@@ -606,14 +606,14 @@ describe('Spreading props', () => {
|
|
|
606
606
|
return <CustomThemeButton {...getProps()}>click me</CustomThemeButton>;
|
|
607
607
|
}
|
|
608
608
|
`,
|
|
609
|
-
|
|
609
|
+
});
|
|
610
610
|
});
|
|
611
611
|
|
|
612
612
|
describe('`type ButtonProps`', () => {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
613
|
+
check({
|
|
614
|
+
transformer,
|
|
615
|
+
it: 'should move to the new standard button props',
|
|
616
|
+
original: `
|
|
617
617
|
import React from 'react';
|
|
618
618
|
import Button, { ButtonProps } from '@atlaskit/button';
|
|
619
619
|
|
|
@@ -621,7 +621,7 @@ describe('`type ButtonProps`', () => {
|
|
|
621
621
|
return <Button>click me</Button>;
|
|
622
622
|
}
|
|
623
623
|
`,
|
|
624
|
-
|
|
624
|
+
expected: `
|
|
625
625
|
import React from 'react';
|
|
626
626
|
|
|
627
627
|
/* TODO: (from codemod) Verify ButtonProps is the right prop type
|
|
@@ -634,5 +634,5 @@ describe('`type ButtonProps`', () => {
|
|
|
634
634
|
return <Button>click me</Button>;
|
|
635
635
|
}
|
|
636
636
|
`,
|
|
637
|
-
|
|
637
|
+
});
|
|
638
638
|
});
|