@atlaskit/button 17.17.2 → 17.18.0
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 +56 -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/containers/button-group.js +3 -1
- package/dist/cjs/new-button/containers/split-button/split-button.js +6 -2
- package/dist/cjs/new-button/variants/default/button.js +8 -1
- package/dist/cjs/new-button/variants/default/link.js +8 -1
- package/dist/cjs/new-button/variants/default/use-default-button.js +7 -1
- package/dist/cjs/new-button/variants/icon/button.js +6 -1
- package/dist/cjs/new-button/variants/icon/link.js +6 -1
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/cjs/new-button/variants/shared/constants.js +7 -0
- package/dist/cjs/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/cjs/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/cjs/old-button/button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/custom-theme-button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/theme.js +1 -1
- package/dist/cjs/old-button/shared/button-base.js +9 -3
- package/dist/cjs/old-button/shared/css.js +4 -3
- package/dist/es2019/containers/button-group.js +3 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +5 -2
- package/dist/es2019/new-button/variants/default/button.js +7 -0
- package/dist/es2019/new-button/variants/default/link.js +9 -2
- package/dist/es2019/new-button/variants/default/use-default-button.js +7 -1
- package/dist/es2019/new-button/variants/icon/button.js +5 -0
- package/dist/es2019/new-button/variants/icon/link.js +8 -3
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/es2019/new-button/variants/shared/constants.js +1 -0
- package/dist/es2019/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/es2019/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/es2019/old-button/button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/theme.js +2 -0
- package/dist/es2019/old-button/shared/button-base.js +10 -3
- package/dist/es2019/old-button/shared/css.js +4 -2
- package/dist/esm/containers/button-group.js +3 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +5 -2
- package/dist/esm/new-button/variants/default/button.js +8 -1
- package/dist/esm/new-button/variants/default/link.js +10 -3
- package/dist/esm/new-button/variants/default/use-default-button.js +7 -1
- package/dist/esm/new-button/variants/icon/button.js +6 -1
- package/dist/esm/new-button/variants/icon/link.js +9 -4
- package/dist/esm/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/esm/new-button/variants/shared/constants.js +1 -0
- package/dist/esm/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/esm/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/esm/old-button/button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/theme.js +2 -0
- package/dist/esm/old-button/shared/button-base.js +10 -3
- package/dist/esm/old-button/shared/css.js +4 -2
- 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-button/variants/default/link.d.ts +1 -1
- package/dist/types/new-button/variants/default/types.d.ts +1 -1
- package/dist/types/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +5 -1
- 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-button/variants/default/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types-ts4.5/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +5 -1
- 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 +202 -201
- package/report.api.md +78 -96
|
@@ -4,10 +4,10 @@ import transformer from '../../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/custom-theme-button';
|
|
24
24
|
|
|
@@ -30,14 +30,14 @@ describe('Change `type ButtonAppearances` to `type Appearance`', () => {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
`,
|
|
33
|
-
|
|
33
|
+
});
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
describe('Changing <Button /> usage', () => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
check({
|
|
38
|
+
transformer,
|
|
39
|
+
it: 'should move to custom theme button',
|
|
40
|
+
original: `
|
|
41
41
|
import React from 'react';
|
|
42
42
|
import Button from '@atlaskit/button';
|
|
43
43
|
|
|
@@ -47,7 +47,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
`,
|
|
50
|
-
|
|
50
|
+
expected: `
|
|
51
51
|
import React from 'react';
|
|
52
52
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
53
53
|
|
|
@@ -57,29 +57,29 @@ describe('Changing <Button /> usage', () => {
|
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
`,
|
|
60
|
-
|
|
60
|
+
});
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
check({
|
|
63
|
+
transformer,
|
|
64
|
+
it: 'should move over when not used in JSX',
|
|
65
|
+
original: `
|
|
66
66
|
import React from 'react';
|
|
67
67
|
import Button from '@atlaskit/button';
|
|
68
68
|
|
|
69
69
|
expect(Button).toBeTruthy();
|
|
70
70
|
`,
|
|
71
|
-
|
|
71
|
+
expected: `
|
|
72
72
|
import React from 'react';
|
|
73
73
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
74
74
|
|
|
75
75
|
expect(Button).toBeTruthy();
|
|
76
76
|
`,
|
|
77
|
-
|
|
77
|
+
});
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
check({
|
|
80
|
+
transformer,
|
|
81
|
+
it: 'should respect self closing tags',
|
|
82
|
+
original: `
|
|
83
83
|
import React from 'react';
|
|
84
84
|
import Button from '@atlaskit/button';
|
|
85
85
|
|
|
@@ -87,7 +87,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
87
87
|
return <Button onClick={() => console.log('hi')} />;
|
|
88
88
|
}
|
|
89
89
|
`,
|
|
90
|
-
|
|
90
|
+
expected: `
|
|
91
91
|
import React from 'react';
|
|
92
92
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
93
93
|
|
|
@@ -95,12 +95,12 @@ describe('Changing <Button /> usage', () => {
|
|
|
95
95
|
return <Button onClick={() => console.log('hi')} />;
|
|
96
96
|
}
|
|
97
97
|
`,
|
|
98
|
-
|
|
98
|
+
});
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
check({
|
|
101
|
+
transformer,
|
|
102
|
+
it: 'should respect the existing alias',
|
|
103
|
+
original: `
|
|
104
104
|
import React from 'react';
|
|
105
105
|
import Button from './our-button';
|
|
106
106
|
import AkButton from '@atlaskit/button';
|
|
@@ -114,7 +114,7 @@ describe('Changing <Button /> usage', () => {
|
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
`,
|
|
117
|
-
|
|
117
|
+
expected: `
|
|
118
118
|
import React from 'react';
|
|
119
119
|
import Button from './our-button';
|
|
120
120
|
import AkButton from '@atlaskit/button/custom-theme-button';
|
|
@@ -128,14 +128,14 @@ describe('Changing <Button /> usage', () => {
|
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
`,
|
|
131
|
-
|
|
131
|
+
});
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
describe('`type ButtonProps` to `type CustomButtonProps`', () => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
check({
|
|
136
|
+
transformer,
|
|
137
|
+
it: 'should move to the new type',
|
|
138
|
+
original: `
|
|
139
139
|
import React from 'react';
|
|
140
140
|
import Button, { ButtonProps } from '@atlaskit/button';
|
|
141
141
|
|
|
@@ -143,7 +143,7 @@ describe('`type ButtonProps` to `type CustomButtonProps`', () => {
|
|
|
143
143
|
return <Button>click me</Button>;
|
|
144
144
|
}
|
|
145
145
|
`,
|
|
146
|
-
|
|
146
|
+
expected: `
|
|
147
147
|
import React from 'react';
|
|
148
148
|
import { CustomThemeButtonProps } from '@atlaskit/button/types';
|
|
149
149
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
@@ -152,12 +152,12 @@ describe('`type ButtonProps` to `type CustomButtonProps`', () => {
|
|
|
152
152
|
return <Button>click me</Button>;
|
|
153
153
|
}
|
|
154
154
|
`,
|
|
155
|
-
|
|
155
|
+
});
|
|
156
156
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
check({
|
|
158
|
+
transformer,
|
|
159
|
+
it: 'should respect aliasing',
|
|
160
|
+
original: `
|
|
161
161
|
import React from 'react';
|
|
162
162
|
import Button, { ButtonProps as Foo } from '@atlaskit/button';
|
|
163
163
|
|
|
@@ -167,7 +167,7 @@ describe('`type ButtonProps` to `type CustomButtonProps`', () => {
|
|
|
167
167
|
return <Button>click me</Button>;
|
|
168
168
|
}
|
|
169
169
|
`,
|
|
170
|
-
|
|
170
|
+
expected: `
|
|
171
171
|
import React from 'react';
|
|
172
172
|
import { CustomThemeButtonProps as Foo } from '@atlaskit/button/types';
|
|
173
173
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
@@ -178,12 +178,12 @@ describe('`type ButtonProps` to `type CustomButtonProps`', () => {
|
|
|
178
178
|
return <Button>click me</Button>;
|
|
179
179
|
}
|
|
180
180
|
`,
|
|
181
|
-
|
|
181
|
+
});
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
check({
|
|
184
|
+
transformer,
|
|
185
|
+
it: 'should avoid clashes',
|
|
186
|
+
original: `
|
|
187
187
|
import React from 'react';
|
|
188
188
|
import { CustomThemeButtonProps } from './my-types';
|
|
189
189
|
import Button, { ButtonProps } from '@atlaskit/button';
|
|
@@ -194,7 +194,7 @@ describe('`type ButtonProps` to `type CustomButtonProps`', () => {
|
|
|
194
194
|
return <Button>click me</Button>;
|
|
195
195
|
}
|
|
196
196
|
`,
|
|
197
|
-
|
|
197
|
+
expected: `
|
|
198
198
|
import React from 'react';
|
|
199
199
|
import { CustomThemeButtonProps } from './my-types';
|
|
200
200
|
import { CustomThemeButtonProps as DSCustomThemeButtonProps } from '@atlaskit/button/types';
|
|
@@ -206,18 +206,18 @@ describe('`type ButtonProps` to `type CustomButtonProps`', () => {
|
|
|
206
206
|
return <Button>click me</Button>;
|
|
207
207
|
}
|
|
208
208
|
`,
|
|
209
|
-
|
|
209
|
+
});
|
|
210
210
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
check({
|
|
212
|
+
transformer,
|
|
213
|
+
it: 'should move from type entry point',
|
|
214
|
+
original: `
|
|
215
215
|
import React from 'react';
|
|
216
216
|
import { ButtonProps } from '@atlaskit/button/types';
|
|
217
217
|
`,
|
|
218
|
-
|
|
218
|
+
expected: `
|
|
219
219
|
import React from 'react';
|
|
220
220
|
import { CustomThemeButtonProps } from '@atlaskit/button/types';
|
|
221
221
|
`,
|
|
222
|
-
|
|
222
|
+
});
|
|
223
223
|
});
|
|
@@ -5,92 +5,92 @@ import optimistic from '../../optimistic-15.0.0-lite-mode';
|
|
|
5
5
|
import { check } from '../_framework';
|
|
6
6
|
|
|
7
7
|
[
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
{
|
|
9
|
+
name: 'safe',
|
|
10
|
+
transformer: safe,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'optimistic',
|
|
14
|
+
transformer: optimistic,
|
|
15
|
+
},
|
|
16
16
|
].forEach(({ name, transformer }) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
describe(`Transformer: ${name}`, () => {
|
|
18
|
+
describe('Change `type ButtonAppearances` to `type Appearance`', () => {
|
|
19
|
+
check({
|
|
20
|
+
it: 'should rename ButtonAppearances type to Appearance',
|
|
21
|
+
transformer,
|
|
22
|
+
original: `
|
|
23
23
|
import { ButtonAppearances } from '@atlaskit/button';
|
|
24
24
|
|
|
25
25
|
const value: ButtonAppearances = 'primary';
|
|
26
26
|
`,
|
|
27
|
-
|
|
27
|
+
expected: `
|
|
28
28
|
import { Appearance } from '@atlaskit/button/types';
|
|
29
29
|
|
|
30
30
|
const value: Appearance = 'primary';
|
|
31
31
|
`,
|
|
32
|
-
|
|
32
|
+
});
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
check({
|
|
35
|
+
it: 'should respect existing aliasing',
|
|
36
|
+
transformer,
|
|
37
|
+
original: `
|
|
38
38
|
import { ButtonAppearances as CustomAppearance } from '@atlaskit/button';
|
|
39
39
|
|
|
40
40
|
const value: CustomAppearance = 'primary';
|
|
41
41
|
`,
|
|
42
|
-
|
|
42
|
+
expected: `
|
|
43
43
|
import { Appearance as CustomAppearance } from '@atlaskit/button/types';
|
|
44
44
|
|
|
45
45
|
const value: CustomAppearance = 'primary';
|
|
46
46
|
`,
|
|
47
|
-
|
|
47
|
+
});
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
check({
|
|
50
|
+
it: 'should fallback to a `DSButtonAppearance` type alias if the `Appearance` identifier name is unavailable',
|
|
51
|
+
transformer,
|
|
52
|
+
original: `
|
|
53
53
|
import { Appearance } from 'some-other-package';
|
|
54
54
|
import { ButtonAppearances } from '@atlaskit/button';
|
|
55
55
|
|
|
56
56
|
const value1: Appearance = 4;
|
|
57
57
|
const value2: ButtonAppearances = 'primary';
|
|
58
58
|
`,
|
|
59
|
-
|
|
59
|
+
expected: `
|
|
60
60
|
import { Appearance } from 'some-other-package';
|
|
61
61
|
import { Appearance as DSButtonAppearance } from '@atlaskit/button/types';
|
|
62
62
|
|
|
63
63
|
const value1: Appearance = 4;
|
|
64
64
|
const value2: DSButtonAppearance = 'primary';
|
|
65
65
|
`,
|
|
66
|
-
|
|
66
|
+
});
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
check({
|
|
69
|
+
it: 'should use the existing type entry point',
|
|
70
|
+
transformer,
|
|
71
|
+
original: `
|
|
72
72
|
import { ButtonAppearances as CustomAppearance } from '@atlaskit/button/types';
|
|
73
73
|
|
|
74
74
|
const value: CustomAppearance = 'primary';
|
|
75
75
|
`,
|
|
76
|
-
|
|
76
|
+
expected: `
|
|
77
77
|
import { Appearance as CustomAppearance } from '@atlaskit/button/types';
|
|
78
78
|
|
|
79
79
|
const value: CustomAppearance = 'primary';
|
|
80
80
|
`,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('ButtonGroup', () => {
|
|
85
|
+
const expectedImport: string =
|
|
86
|
+
transformer === optimistic
|
|
87
|
+
? '@atlaskit/button/standard-button'
|
|
88
|
+
: '@atlaskit/button/custom-theme-button';
|
|
89
|
+
|
|
90
|
+
check({
|
|
91
|
+
transformer,
|
|
92
|
+
it: 'should move button group over to the new import',
|
|
93
|
+
original: `
|
|
94
94
|
import React from 'react';
|
|
95
95
|
import Button, { ButtonGroup } from '@atlaskit/button';
|
|
96
96
|
|
|
@@ -98,7 +98,7 @@ import { check } from '../_framework';
|
|
|
98
98
|
return <ButtonGroup><Button>click me</Button></ButtonGroup>;
|
|
99
99
|
}
|
|
100
100
|
`,
|
|
101
|
-
|
|
101
|
+
expected: `
|
|
102
102
|
import React from 'react';
|
|
103
103
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
104
104
|
import Button from '${expectedImport}';
|
|
@@ -107,12 +107,12 @@ import { check } from '../_framework';
|
|
|
107
107
|
return <ButtonGroup><Button>click me</Button></ButtonGroup>;
|
|
108
108
|
}
|
|
109
109
|
`,
|
|
110
|
-
|
|
110
|
+
});
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
check({
|
|
113
|
+
transformer,
|
|
114
|
+
it: 'should respect aliasing',
|
|
115
|
+
original: `
|
|
116
116
|
import React from 'react';
|
|
117
117
|
import Button, { ButtonGroup as AkButtonGroup } from '@atlaskit/button';
|
|
118
118
|
|
|
@@ -120,7 +120,7 @@ import { check } from '../_framework';
|
|
|
120
120
|
return <AkButtonGroup><Button>click me</Button></AkButtonGroup>;
|
|
121
121
|
}
|
|
122
122
|
`,
|
|
123
|
-
|
|
123
|
+
expected: `
|
|
124
124
|
import React from 'react';
|
|
125
125
|
import AkButtonGroup from '@atlaskit/button/button-group';
|
|
126
126
|
import Button from '${expectedImport}';
|
|
@@ -129,46 +129,46 @@ import { check } from '../_framework';
|
|
|
129
129
|
return <AkButtonGroup><Button>click me</Button></AkButtonGroup>;
|
|
130
130
|
}
|
|
131
131
|
`,
|
|
132
|
-
|
|
132
|
+
});
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
check({
|
|
135
|
+
transformer,
|
|
136
|
+
it: 'avoid clashing when shifting',
|
|
137
|
+
original: `
|
|
138
138
|
import React from 'react';
|
|
139
139
|
import { ButtonGroup } from '@atlaskit/button';
|
|
140
140
|
|
|
141
141
|
expect(ButtonGroup).toBeTruthy();
|
|
142
142
|
`,
|
|
143
|
-
|
|
143
|
+
expected: `
|
|
144
144
|
import React from 'react';
|
|
145
145
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
146
146
|
|
|
147
147
|
expect(ButtonGroup).toBeTruthy();
|
|
148
148
|
`,
|
|
149
|
-
|
|
149
|
+
});
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
check({
|
|
152
|
+
transformer,
|
|
153
|
+
it: 'should move over when not used in JSX',
|
|
154
|
+
original: `
|
|
155
155
|
import React from 'react';
|
|
156
156
|
import { ButtonGroup } from '@atlaskit/button';
|
|
157
157
|
|
|
158
158
|
expect(ButtonGroup).toBeTruthy();
|
|
159
159
|
`,
|
|
160
|
-
|
|
160
|
+
expected: `
|
|
161
161
|
import React from 'react';
|
|
162
162
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
163
163
|
|
|
164
164
|
expect(ButtonGroup).toBeTruthy();
|
|
165
165
|
`,
|
|
166
|
-
|
|
166
|
+
});
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
check({
|
|
169
|
+
transformer,
|
|
170
|
+
it: 'should avoid touching unrelated button groups',
|
|
171
|
+
original: `
|
|
172
172
|
import React from 'react';
|
|
173
173
|
import Button from '@atlaskit/button';
|
|
174
174
|
import { ButtonGroup } from './something';
|
|
@@ -177,7 +177,7 @@ import { check } from '../_framework';
|
|
|
177
177
|
return <ButtonGroup><Button>click me</Button></ButtonGroup>;
|
|
178
178
|
}
|
|
179
179
|
`,
|
|
180
|
-
|
|
180
|
+
expected: `
|
|
181
181
|
import React from 'react';
|
|
182
182
|
import Button from '${expectedImport}';
|
|
183
183
|
import { ButtonGroup } from './something';
|
|
@@ -186,47 +186,46 @@ import { check } from '../_framework';
|
|
|
186
186
|
return <ButtonGroup><Button>click me</Button></ButtonGroup>;
|
|
187
187
|
}
|
|
188
188
|
`,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
describe('Theme', () => {
|
|
193
|
+
check({
|
|
194
|
+
it: 'should move Theme to the custom-theme-button export',
|
|
195
|
+
transformer,
|
|
196
|
+
original: `
|
|
197
197
|
import React from 'react';
|
|
198
198
|
import { Theme } from '@atlaskit/button';
|
|
199
199
|
`,
|
|
200
|
-
|
|
200
|
+
expected: `
|
|
201
201
|
import React from 'react';
|
|
202
202
|
import { Theme } from '@atlaskit/button/custom-theme-button';
|
|
203
203
|
`,
|
|
204
|
-
|
|
204
|
+
});
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
check({
|
|
207
|
+
it: 'should respect aliasing',
|
|
208
|
+
transformer,
|
|
209
|
+
original: `
|
|
210
210
|
import React from 'react';
|
|
211
211
|
import { Theme as ButtonTheme } from '@atlaskit/button';
|
|
212
212
|
|
|
213
213
|
type Value = ButtonTheme & { foo: string };
|
|
214
214
|
`,
|
|
215
|
-
|
|
215
|
+
expected: `
|
|
216
216
|
import React from 'react';
|
|
217
217
|
import { Theme as ButtonTheme } from '@atlaskit/button/custom-theme-button';
|
|
218
218
|
|
|
219
219
|
type Value = ButtonTheme & { foo: string };
|
|
220
220
|
`,
|
|
221
|
-
|
|
221
|
+
});
|
|
222
222
|
|
|
223
|
-
|
|
224
|
-
transformer === optimistic ? 'CustomThemeButton' : 'Button';
|
|
223
|
+
const expectedName: string = transformer === optimistic ? 'CustomThemeButton' : 'Button';
|
|
225
224
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
check({
|
|
226
|
+
it: 'should merge imports',
|
|
227
|
+
transformer,
|
|
228
|
+
original: `
|
|
230
229
|
import React from 'react';
|
|
231
230
|
import Button, { Theme as ButtonTheme } from '@atlaskit/button';
|
|
232
231
|
|
|
@@ -238,7 +237,7 @@ import { check } from '../_framework';
|
|
|
238
237
|
);
|
|
239
238
|
}
|
|
240
239
|
`,
|
|
241
|
-
|
|
240
|
+
expected: `
|
|
242
241
|
import React from 'react';
|
|
243
242
|
import ${expectedName}, { Theme as ButtonTheme } from '@atlaskit/button/custom-theme-button';
|
|
244
243
|
|
|
@@ -250,7 +249,7 @@ import { check } from '../_framework';
|
|
|
250
249
|
);
|
|
251
250
|
}
|
|
252
251
|
`,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
});
|
|
256
255
|
});
|