@atlaskit/menu 2.14.2 → 2.14.4
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 +14 -0
- package/package.json +11 -8
- package/codemods/0.7.0-change-css-fn-prop.tsx +0 -149
- package/codemods/2.1.0-invalid-link-item-to-button-item.tsx +0 -146
- package/codemods/__tests__/0.7.0-change-css-fn-prop.tsx +0 -360
- package/codemods/__tests__/next-invalid-link-item-to-button-item.tsx +0 -308
- package/codemods/helpers/generic.tsx +0 -637
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
jest.autoMockOff();
|
|
2
|
-
|
|
3
|
-
import * as transformer from '../0.7.0-change-css-fn-prop';
|
|
4
|
-
|
|
5
|
-
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
|
-
|
|
7
|
-
describe('Updates and removes current inline styles', () => {
|
|
8
|
-
defineInlineTest(
|
|
9
|
-
{ ...transformer, parser: 'tsx' },
|
|
10
|
-
{},
|
|
11
|
-
`
|
|
12
|
-
import { ButtonItem } from '@atlaskit/something';
|
|
13
|
-
|
|
14
|
-
const App = () => {
|
|
15
|
-
return <ButtonItem />;
|
|
16
|
-
}
|
|
17
|
-
`,
|
|
18
|
-
`
|
|
19
|
-
import { ButtonItem } from '@atlaskit/something';
|
|
20
|
-
|
|
21
|
-
const App = () => {
|
|
22
|
-
return <ButtonItem />;
|
|
23
|
-
}
|
|
24
|
-
`,
|
|
25
|
-
'leaves unrelated code untouched',
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
defineInlineTest(
|
|
29
|
-
{ ...transformer, parser: 'tsx' },
|
|
30
|
-
{},
|
|
31
|
-
`
|
|
32
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
33
|
-
|
|
34
|
-
const App = () => {
|
|
35
|
-
return <ButtonItem cssFn={(styles, state) => ({
|
|
36
|
-
|
|
37
|
-
})} />;
|
|
38
|
-
}
|
|
39
|
-
`,
|
|
40
|
-
`
|
|
41
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
42
|
-
|
|
43
|
-
const App = () => {
|
|
44
|
-
return (
|
|
45
|
-
<ButtonItem cssFn={state => {
|
|
46
|
-
|
|
47
|
-
}} />
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
`,
|
|
51
|
-
'should remove current styles from inline function',
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
defineInlineTest(
|
|
55
|
-
{ ...transformer, parser: 'tsx' },
|
|
56
|
-
{},
|
|
57
|
-
`
|
|
58
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
59
|
-
|
|
60
|
-
const App = () => {
|
|
61
|
-
return (
|
|
62
|
-
<div cssFn={(styles, state) => ({
|
|
63
|
-
...styles,
|
|
64
|
-
})}>
|
|
65
|
-
<ButtonItem
|
|
66
|
-
cssFn={(styles, state) => ({
|
|
67
|
-
...styles,
|
|
68
|
-
})}
|
|
69
|
-
/>
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
`,
|
|
75
|
-
`
|
|
76
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
77
|
-
|
|
78
|
-
const App = () => {
|
|
79
|
-
return (
|
|
80
|
-
<div cssFn={(styles, state) => ({
|
|
81
|
-
...styles,
|
|
82
|
-
})}>
|
|
83
|
-
<ButtonItem
|
|
84
|
-
cssFn={state => ({})}
|
|
85
|
-
/>
|
|
86
|
-
</div>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
`,
|
|
90
|
-
'should remove current styles from scope',
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
defineInlineTest(
|
|
94
|
-
{ ...transformer, parser: 'tsx' },
|
|
95
|
-
{},
|
|
96
|
-
`
|
|
97
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
98
|
-
|
|
99
|
-
const App = () => {
|
|
100
|
-
return <ButtonItem cssFn={(styles, state) => ({
|
|
101
|
-
...styles,
|
|
102
|
-
color: 'red',
|
|
103
|
-
})} />;
|
|
104
|
-
}
|
|
105
|
-
`,
|
|
106
|
-
`
|
|
107
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
108
|
-
|
|
109
|
-
const App = () => {
|
|
110
|
-
return (
|
|
111
|
-
<ButtonItem cssFn={state => ({
|
|
112
|
-
color: 'red',
|
|
113
|
-
})} />
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
`,
|
|
117
|
-
'correctly removes spread styles',
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
defineInlineTest(
|
|
121
|
-
{ ...transformer, parser: 'tsx' },
|
|
122
|
-
{},
|
|
123
|
-
`
|
|
124
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
125
|
-
|
|
126
|
-
const App = () => {
|
|
127
|
-
return <ButtonItem cssFn={(styles, state) => ({
|
|
128
|
-
...styles,
|
|
129
|
-
color: 'red',
|
|
130
|
-
':hover': {
|
|
131
|
-
...styles[':hover'],
|
|
132
|
-
color: 'blue',
|
|
133
|
-
}
|
|
134
|
-
})} />;
|
|
135
|
-
}
|
|
136
|
-
`,
|
|
137
|
-
`
|
|
138
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
139
|
-
|
|
140
|
-
const App = () => {
|
|
141
|
-
return (
|
|
142
|
-
<ButtonItem cssFn={state => ({
|
|
143
|
-
color: 'red',
|
|
144
|
-
|
|
145
|
-
':hover': {
|
|
146
|
-
color: 'blue',
|
|
147
|
-
},
|
|
148
|
-
})} />
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
`,
|
|
152
|
-
'correctly removes spread styles with pseudo-selector access',
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
defineInlineTest(
|
|
156
|
-
{ ...transformer, parser: 'tsx' },
|
|
157
|
-
{},
|
|
158
|
-
`
|
|
159
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
160
|
-
|
|
161
|
-
const App = () => {
|
|
162
|
-
return (
|
|
163
|
-
<ButtonItem cssFn={(styles, state) => ({
|
|
164
|
-
...(state.x ? styles : {}),
|
|
165
|
-
color: 'red',
|
|
166
|
-
})} />
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
`,
|
|
170
|
-
`
|
|
171
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
172
|
-
|
|
173
|
-
const App = () => {
|
|
174
|
-
return (
|
|
175
|
-
<ButtonItem
|
|
176
|
-
/*
|
|
177
|
-
TODO: (from codemod) The usage of the 'cssFn' prop in this component could not be transformed and requires manual intervention.
|
|
178
|
-
The 'cssFn' prop has been simplified so that users no longer need to merge the inherited styles with their own overrides.
|
|
179
|
-
For more info please reach out to #help-design-system-code.
|
|
180
|
-
*/
|
|
181
|
-
cssFn={(styles, state) => ({
|
|
182
|
-
...(state.x ? styles : {}),
|
|
183
|
-
color: 'red',
|
|
184
|
-
})} />
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
`,
|
|
188
|
-
'fail smoothly if the current styles are being used in a non-trivial way',
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
defineInlineTest(
|
|
192
|
-
{ ...transformer, parser: 'tsx' },
|
|
193
|
-
{},
|
|
194
|
-
`
|
|
195
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
196
|
-
|
|
197
|
-
const App = () => {
|
|
198
|
-
return <ButtonItem cssFn={() => ({
|
|
199
|
-
color: 'red',
|
|
200
|
-
})} />;
|
|
201
|
-
}
|
|
202
|
-
`,
|
|
203
|
-
`
|
|
204
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
205
|
-
|
|
206
|
-
const App = () => {
|
|
207
|
-
return <ButtonItem cssFn={() => ({
|
|
208
|
-
color: 'red',
|
|
209
|
-
})} />;
|
|
210
|
-
}
|
|
211
|
-
`,
|
|
212
|
-
'not change anything if user is not using the current state or styles',
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
defineInlineTest(
|
|
216
|
-
{ ...transformer, parser: 'tsx' },
|
|
217
|
-
{},
|
|
218
|
-
`
|
|
219
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
220
|
-
|
|
221
|
-
const App = () => {
|
|
222
|
-
return <ButtonItem cssFn={(styles, state) => ({
|
|
223
|
-
...styles,
|
|
224
|
-
color: 'red',
|
|
225
|
-
})}>
|
|
226
|
-
<ButtonItem cssFn={(styles, state) => ({
|
|
227
|
-
...styles,
|
|
228
|
-
color: 'red',
|
|
229
|
-
})}/>
|
|
230
|
-
</ButtonItem>;
|
|
231
|
-
}
|
|
232
|
-
`,
|
|
233
|
-
`
|
|
234
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
235
|
-
|
|
236
|
-
const App = () => {
|
|
237
|
-
return (
|
|
238
|
-
<ButtonItem cssFn={state => ({
|
|
239
|
-
color: 'red',
|
|
240
|
-
})}>
|
|
241
|
-
<ButtonItem cssFn={state => ({
|
|
242
|
-
color: 'red',
|
|
243
|
-
})}/>
|
|
244
|
-
</ButtonItem>
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
`,
|
|
248
|
-
'should remove styles in nested children',
|
|
249
|
-
);
|
|
250
|
-
|
|
251
|
-
defineInlineTest(
|
|
252
|
-
{ ...transformer, parser: 'tsx' },
|
|
253
|
-
{},
|
|
254
|
-
`
|
|
255
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
256
|
-
|
|
257
|
-
const App = () => {
|
|
258
|
-
return <ButtonItem />;
|
|
259
|
-
}
|
|
260
|
-
`,
|
|
261
|
-
`
|
|
262
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
263
|
-
|
|
264
|
-
const App = () => {
|
|
265
|
-
return <ButtonItem />;
|
|
266
|
-
}
|
|
267
|
-
`,
|
|
268
|
-
'should leave affected items with no use of cssFn untouched',
|
|
269
|
-
);
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
describe('Updates and removes current styles', () => {
|
|
273
|
-
defineInlineTest(
|
|
274
|
-
{ ...transformer, parser: 'tsx' },
|
|
275
|
-
{},
|
|
276
|
-
`
|
|
277
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
278
|
-
|
|
279
|
-
const cssFn = (styles, state) => ({
|
|
280
|
-
...styles,
|
|
281
|
-
color: 'red',
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
const App = () => {
|
|
285
|
-
return <ButtonItem cssFn={cssFn} />;
|
|
286
|
-
}
|
|
287
|
-
`,
|
|
288
|
-
`
|
|
289
|
-
import { ButtonItem } from '@atlaskit/menu';
|
|
290
|
-
|
|
291
|
-
const cssFn = (styles, state) => ({
|
|
292
|
-
...styles,
|
|
293
|
-
color: 'red',
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
const App = () => {
|
|
297
|
-
return (
|
|
298
|
-
<ButtonItem
|
|
299
|
-
/*
|
|
300
|
-
TODO: (from codemod) The usage of the 'cssFn' prop in this component could not be transformed and requires manual intervention.
|
|
301
|
-
The 'cssFn' prop has been simplified so that users no longer need to merge the inherited styles with their own overrides.
|
|
302
|
-
For more info please reach out to #help-design-system-code.
|
|
303
|
-
*/
|
|
304
|
-
cssFn={cssFn} />
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
`,
|
|
308
|
-
'should add prompt for non-inline function',
|
|
309
|
-
);
|
|
310
|
-
|
|
311
|
-
defineInlineTest(
|
|
312
|
-
{ ...transformer, parser: 'tsx' },
|
|
313
|
-
{},
|
|
314
|
-
`
|
|
315
|
-
import { ButtonItem, LinkItem } from '@atlaskit/menu';
|
|
316
|
-
|
|
317
|
-
const cssFunction = (styles, state) => ({
|
|
318
|
-
...styles,
|
|
319
|
-
color: 'red',
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
const App = () => {
|
|
323
|
-
return (
|
|
324
|
-
<ButtonItem cssFn={cssFunction}>
|
|
325
|
-
<LinkItem cssFn={cssFunction} />
|
|
326
|
-
</ButtonItem>
|
|
327
|
-
);
|
|
328
|
-
};
|
|
329
|
-
`,
|
|
330
|
-
`
|
|
331
|
-
import { ButtonItem, LinkItem } from '@atlaskit/menu';
|
|
332
|
-
|
|
333
|
-
const cssFunction = (styles, state) => ({
|
|
334
|
-
...styles,
|
|
335
|
-
color: 'red',
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
const App = () => {
|
|
339
|
-
return (
|
|
340
|
-
<ButtonItem
|
|
341
|
-
/*
|
|
342
|
-
TODO: (from codemod) The usage of the 'cssFn' prop in this component could not be transformed and requires manual intervention.
|
|
343
|
-
The 'cssFn' prop has been simplified so that users no longer need to merge the inherited styles with their own overrides.
|
|
344
|
-
For more info please reach out to #help-design-system-code.
|
|
345
|
-
*/
|
|
346
|
-
cssFn={cssFunction}>
|
|
347
|
-
<LinkItem
|
|
348
|
-
/*
|
|
349
|
-
TODO: (from codemod) The usage of the 'cssFn' prop in this component could not be transformed and requires manual intervention.
|
|
350
|
-
The 'cssFn' prop has been simplified so that users no longer need to merge the inherited styles with their own overrides.
|
|
351
|
-
For more info please reach out to #help-design-system-code.
|
|
352
|
-
*/
|
|
353
|
-
cssFn={cssFunction} />
|
|
354
|
-
</ButtonItem>
|
|
355
|
-
);
|
|
356
|
-
};
|
|
357
|
-
`,
|
|
358
|
-
'should add prompt for non-inline function to multiple instances',
|
|
359
|
-
);
|
|
360
|
-
});
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
jest.autoMockOff();
|
|
2
|
-
|
|
3
|
-
import * as transformer from '../2.1.0-invalid-link-item-to-button-item';
|
|
4
|
-
|
|
5
|
-
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
|
-
|
|
7
|
-
describe('Converts link items with invalid or missing `href` to button items', () => {
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Success cases
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
defineInlineTest(
|
|
14
|
-
{ ...transformer, parser: 'tsx' },
|
|
15
|
-
{},
|
|
16
|
-
`
|
|
17
|
-
import { LinkItem } from '@atlaskit/something';
|
|
18
|
-
|
|
19
|
-
const App = () => {
|
|
20
|
-
return <LinkItem />;
|
|
21
|
-
}
|
|
22
|
-
`,
|
|
23
|
-
`
|
|
24
|
-
import { LinkItem } from '@atlaskit/something';
|
|
25
|
-
|
|
26
|
-
const App = () => {
|
|
27
|
-
return <LinkItem />;
|
|
28
|
-
}
|
|
29
|
-
`,
|
|
30
|
-
'leaves unrelated code untouched',
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
defineInlineTest(
|
|
34
|
-
{ ...transformer, parser: 'tsx' },
|
|
35
|
-
{},
|
|
36
|
-
`
|
|
37
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
38
|
-
import { variable } from 'somewhere';
|
|
39
|
-
|
|
40
|
-
const App = () => {
|
|
41
|
-
return <LinkItem href={variable}>test</LinkItem>;
|
|
42
|
-
}
|
|
43
|
-
`,
|
|
44
|
-
`
|
|
45
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
46
|
-
import { variable } from 'somewhere';
|
|
47
|
-
|
|
48
|
-
const App = () => {
|
|
49
|
-
return <LinkItem href={variable}>test</LinkItem>;
|
|
50
|
-
}
|
|
51
|
-
`,
|
|
52
|
-
'should not do anything with `href`s that are variables',
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
defineInlineTest(
|
|
56
|
-
{ ...transformer, parser: 'tsx' },
|
|
57
|
-
{},
|
|
58
|
-
`
|
|
59
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
60
|
-
|
|
61
|
-
const App = () => {
|
|
62
|
-
return <LinkItem href="http://valid.com">test</LinkItem>;
|
|
63
|
-
}
|
|
64
|
-
`,
|
|
65
|
-
`
|
|
66
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
67
|
-
|
|
68
|
-
const App = () => {
|
|
69
|
-
return <LinkItem href="http://valid.com">test</LinkItem>;
|
|
70
|
-
}
|
|
71
|
-
`,
|
|
72
|
-
'should not do anything with a valid `href`',
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* Missing `href`
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
defineInlineTest(
|
|
82
|
-
{ ...transformer, parser: 'tsx' },
|
|
83
|
-
{},
|
|
84
|
-
`
|
|
85
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
86
|
-
|
|
87
|
-
const App = () => {
|
|
88
|
-
return <LinkItem>test</LinkItem>;
|
|
89
|
-
}
|
|
90
|
-
`,
|
|
91
|
-
`
|
|
92
|
-
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
93
|
-
|
|
94
|
-
const App = () => {
|
|
95
|
-
return <ButtonItem>test</ButtonItem>;
|
|
96
|
-
}
|
|
97
|
-
`,
|
|
98
|
-
'Should convert to ButtonItem if no href exists on LinkItem',
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
defineInlineTest(
|
|
102
|
-
{ ...transformer, parser: 'tsx' },
|
|
103
|
-
{},
|
|
104
|
-
`
|
|
105
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
106
|
-
|
|
107
|
-
const App = () => {
|
|
108
|
-
return <LinkItem id="test">test</LinkItem>;
|
|
109
|
-
}
|
|
110
|
-
`,
|
|
111
|
-
`
|
|
112
|
-
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
113
|
-
|
|
114
|
-
const App = () => {
|
|
115
|
-
return <ButtonItem id="test">test</ButtonItem>;
|
|
116
|
-
}
|
|
117
|
-
`,
|
|
118
|
-
'Should convert to ButtonItem but keep existing props if no href exists on LinkItem',
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
*
|
|
123
|
-
* Invalid `href`
|
|
124
|
-
*
|
|
125
|
-
*/
|
|
126
|
-
|
|
127
|
-
defineInlineTest(
|
|
128
|
-
{ ...transformer, parser: 'tsx' },
|
|
129
|
-
{},
|
|
130
|
-
`
|
|
131
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
132
|
-
|
|
133
|
-
const App = () => {
|
|
134
|
-
return <LinkItem href="#">test</LinkItem>;
|
|
135
|
-
}
|
|
136
|
-
`,
|
|
137
|
-
`
|
|
138
|
-
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
139
|
-
|
|
140
|
-
const App = () => {
|
|
141
|
-
return <ButtonItem>test</ButtonItem>;
|
|
142
|
-
}
|
|
143
|
-
`,
|
|
144
|
-
'Should convert to ButtonItem if invalid `href`',
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
defineInlineTest(
|
|
148
|
-
{ ...transformer, parser: 'tsx' },
|
|
149
|
-
{},
|
|
150
|
-
`
|
|
151
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
152
|
-
|
|
153
|
-
const App = () => {
|
|
154
|
-
return <LinkItem href="#" id="test">test</LinkItem>;
|
|
155
|
-
}
|
|
156
|
-
`,
|
|
157
|
-
`
|
|
158
|
-
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
159
|
-
|
|
160
|
-
const App = () => {
|
|
161
|
-
return <ButtonItem id="test">test</ButtonItem>;
|
|
162
|
-
}
|
|
163
|
-
`,
|
|
164
|
-
'Should convert to ButtonItem but keep existing props if invalid `href`',
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
defineInlineTest(
|
|
168
|
-
{ ...transformer, parser: 'tsx' },
|
|
169
|
-
{},
|
|
170
|
-
`
|
|
171
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
172
|
-
|
|
173
|
-
const App = () => {
|
|
174
|
-
return <LinkItem href="">test</LinkItem>;
|
|
175
|
-
}
|
|
176
|
-
`,
|
|
177
|
-
`
|
|
178
|
-
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
179
|
-
|
|
180
|
-
const App = () => {
|
|
181
|
-
return <ButtonItem>test</ButtonItem>;
|
|
182
|
-
}
|
|
183
|
-
`,
|
|
184
|
-
'Should convert to ButtonItem if invalid `href`',
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
*
|
|
189
|
-
* Expressions
|
|
190
|
-
*
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
defineInlineTest(
|
|
194
|
-
{ ...transformer, parser: 'tsx' },
|
|
195
|
-
{},
|
|
196
|
-
`
|
|
197
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
198
|
-
|
|
199
|
-
const App = () => {
|
|
200
|
-
return <LinkItem href={''}>test</LinkItem>;
|
|
201
|
-
}
|
|
202
|
-
`,
|
|
203
|
-
`
|
|
204
|
-
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
205
|
-
|
|
206
|
-
const App = () => {
|
|
207
|
-
return <ButtonItem>test</ButtonItem>;
|
|
208
|
-
}
|
|
209
|
-
`,
|
|
210
|
-
'should handle strings in expression containers',
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
*
|
|
215
|
-
* Edge cases
|
|
216
|
-
*
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
defineInlineTest(
|
|
220
|
-
{ ...transformer, parser: 'tsx' },
|
|
221
|
-
{},
|
|
222
|
-
`
|
|
223
|
-
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
224
|
-
|
|
225
|
-
const App = () => {
|
|
226
|
-
return (
|
|
227
|
-
<div>
|
|
228
|
-
<LinkItem href="">test 1</LinkItem>
|
|
229
|
-
<ButtonItem>test 2</ButtonItem>
|
|
230
|
-
</div>
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
`,
|
|
234
|
-
`
|
|
235
|
-
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
236
|
-
|
|
237
|
-
const App = () => {
|
|
238
|
-
return (
|
|
239
|
-
<div>
|
|
240
|
-
<ButtonItem>test 1</ButtonItem>
|
|
241
|
-
<ButtonItem>test 2</ButtonItem>
|
|
242
|
-
</div>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
`,
|
|
246
|
-
'Should handle multiple item types',
|
|
247
|
-
);
|
|
248
|
-
|
|
249
|
-
defineInlineTest(
|
|
250
|
-
{ ...transformer, parser: 'tsx' },
|
|
251
|
-
{},
|
|
252
|
-
`
|
|
253
|
-
import { LinkItem, CustomItem } from '@atlaskit/menu';
|
|
254
|
-
|
|
255
|
-
const App = () => {
|
|
256
|
-
return (
|
|
257
|
-
<div>
|
|
258
|
-
<LinkItem href="">test 1</LinkItem>
|
|
259
|
-
<CustomItem>test 2</CustomItem>
|
|
260
|
-
</div>
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
`,
|
|
264
|
-
`
|
|
265
|
-
import { LinkItem, CustomItem, ButtonItem } from '@atlaskit/menu';
|
|
266
|
-
|
|
267
|
-
const App = () => {
|
|
268
|
-
return (
|
|
269
|
-
<div>
|
|
270
|
-
<ButtonItem>test 1</ButtonItem>
|
|
271
|
-
<CustomItem>test 2</CustomItem>
|
|
272
|
-
</div>
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
`,
|
|
276
|
-
'Should not delete any imports',
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
defineInlineTest(
|
|
280
|
-
{ ...transformer, parser: 'tsx' },
|
|
281
|
-
{},
|
|
282
|
-
`
|
|
283
|
-
import { LinkItem } from '@atlaskit/menu';
|
|
284
|
-
|
|
285
|
-
const App = () => {
|
|
286
|
-
return (
|
|
287
|
-
<div>
|
|
288
|
-
<LinkItem href="">test 1</LinkItem>
|
|
289
|
-
<LinkItem href="http://example.com">test 2</LinkItem>
|
|
290
|
-
</div>
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
`,
|
|
294
|
-
`
|
|
295
|
-
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
296
|
-
|
|
297
|
-
const App = () => {
|
|
298
|
-
return (
|
|
299
|
-
<div>
|
|
300
|
-
<ButtonItem>test 1</ButtonItem>
|
|
301
|
-
<LinkItem href="http://example.com">test 2</LinkItem>
|
|
302
|
-
</div>
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
`,
|
|
306
|
-
'Should allow valid `href` and convert invalid ones',
|
|
307
|
-
);
|
|
308
|
-
});
|