@atlaskit/code 15.2.0 → 15.3.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 +653 -645
- package/__perf__/code-block-syntax-highlighting.tsx +4 -1
- package/__perf__/source-code-examples/100-line-example.tsx +52 -40
- package/codemods/13.0.0-remove-unnecessary-code-props.tsx +61 -75
- package/codemods/13.0.0-rename-imports.tsx +214 -251
- package/codemods/14.0.0-lite-mode.tsx +5 -9
- package/codemods/__tests__/13.0.0-remove-unnecessary-code-props.tsx +43 -43
- package/codemods/__tests__/13.0.0-rename-imports.tsx +143 -143
- package/codemods/__tests__/14.0.0-lite-mode/14.0.0-lite-mode.tsx +35 -35
- package/codemods/__tests__/14.0.0-lite-mode/remove-language.tsx +21 -21
- package/codemods/__tests__/14.0.0-lite-mode/text-to-child.tsx +35 -35
- package/codemods/migrations/14.0.0-lite-mode/remove-language.tsx +1 -6
- package/codemods/migrations/14.0.0-lite-mode/text-to-child.tsx +53 -61
- package/codemods/utils/helpers.tsx +161 -201
- package/dist/cjs/bidi-warning/ui/styled.js +7 -0
- package/dist/cjs/code-block.js +8 -1
- package/dist/cjs/code.js +5 -0
- package/dist/cjs/internal/theme/styles.js +3 -2
- package/dist/cjs/syntax-highlighter/types.js +1 -0
- package/dist/es2019/bidi-warning/ui/styled.js +7 -0
- package/dist/es2019/code-block.js +8 -1
- package/dist/es2019/code.js +6 -0
- package/dist/es2019/internal/theme/styles.js +4 -1
- package/dist/es2019/syntax-highlighter/types.js +3 -0
- package/dist/esm/bidi-warning/ui/styled.js +7 -0
- package/dist/esm/code-block.js +8 -1
- package/dist/esm/code.js +6 -0
- package/dist/esm/internal/theme/styles.js +4 -1
- package/dist/esm/syntax-highlighter/types.js +3 -0
- package/dist/types/bidi-warning/ui/index.d.ts +1 -1
- package/dist/types/bidi-warning/ui/styled.d.ts +4 -1
- package/dist/types/code.d.ts +3 -0
- package/dist/types/extract-react-types/code-block.d.ts +16 -16
- package/dist/types/internal/hooks/use-highlight.d.ts +1 -1
- package/dist/types/internal/utils/get-normalized-language.d.ts +1 -1
- package/dist/types/syntax-highlighter/async.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/highlight.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/create-line-element.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/create-line.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/flatten-code-tree.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/get-code-tree.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/get-inline-line-number.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/process/index.d.ts +1 -1
- package/dist/types/syntax-highlighter/lib/react-renderer/create-children.d.ts +2 -2
- package/dist/types/syntax-highlighter/lib/react-renderer/create-element.d.ts +2 -2
- package/dist/types/syntax-highlighter/lib/react-renderer/index.d.ts +1 -1
- package/dist/types/syntax-highlighter/types.d.ts +2 -2
- package/dist/types/types.d.ts +1 -1
- package/dist/types-ts4.5/bidi-warning/ui/index.d.ts +1 -1
- package/dist/types-ts4.5/bidi-warning/ui/styled.d.ts +4 -1
- package/dist/types-ts4.5/code.d.ts +3 -0
- package/dist/types-ts4.5/extract-react-types/code-block.d.ts +16 -16
- package/dist/types-ts4.5/internal/hooks/use-highlight.d.ts +1 -1
- package/dist/types-ts4.5/internal/utils/get-normalized-language.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/async.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/highlight.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line-element.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/flatten-code-tree.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/get-code-tree.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/get-inline-line-number.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/process/index.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/create-children.d.ts +2 -2
- package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/create-element.d.ts +2 -2
- package/dist/types-ts4.5/syntax-highlighter/lib/react-renderer/index.d.ts +1 -1
- package/dist/types-ts4.5/syntax-highlighter/types.d.ts +2 -2
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/package.json +108 -110
- package/report.api.md +807 -807
|
@@ -5,35 +5,35 @@ import transformer from '../13.0.0-rename-imports';
|
|
|
5
5
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
6
|
|
|
7
7
|
describe('Rename imports', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
8
|
+
defineInlineTest(
|
|
9
|
+
{ default: transformer, parser: 'tsx' },
|
|
10
|
+
{},
|
|
11
|
+
`import React from 'react';`,
|
|
12
|
+
`import React from 'react';`,
|
|
13
|
+
'should not transform if imports are not present',
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
describe('#AkCode import', () => {
|
|
17
|
+
defineInlineTest(
|
|
18
|
+
{ default: transformer, parser: 'tsx' },
|
|
19
|
+
{},
|
|
20
|
+
`import { AkCode } from '@atlaskit/code';`,
|
|
21
|
+
`import { Code } from '@atlaskit/code';`,
|
|
22
|
+
`transforms import name "AkCode" to "Code"`,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
defineInlineTest(
|
|
26
|
+
{ default: transformer, parser: 'tsx' },
|
|
27
|
+
{},
|
|
28
|
+
`import { AkCode as CodeComponent } from '@atlaskit/code';`,
|
|
29
|
+
`import { Code as CodeComponent } from '@atlaskit/code';`,
|
|
30
|
+
`transforms import name "AkCode" with some other name to "Code"`,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
defineInlineTest(
|
|
34
|
+
{ default: transformer, parser: 'tsx' },
|
|
35
|
+
{},
|
|
36
|
+
`
|
|
37
37
|
import React from 'react';
|
|
38
38
|
import { AkCode } from '@atlaskit/code';
|
|
39
39
|
|
|
@@ -55,7 +55,7 @@ describe('Rename imports', () => {
|
|
|
55
55
|
AkCode: () => null,
|
|
56
56
|
};
|
|
57
57
|
`,
|
|
58
|
-
|
|
58
|
+
`
|
|
59
59
|
import React from 'react';
|
|
60
60
|
import { Code } from '@atlaskit/code';
|
|
61
61
|
|
|
@@ -77,104 +77,104 @@ describe('Rename imports', () => {
|
|
|
77
77
|
AkCode: () => null,
|
|
78
78
|
};
|
|
79
79
|
`,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
`transforms import name "AkCode" to "Code" along with its usage`,
|
|
81
|
+
);
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
defineInlineTest(
|
|
84
|
+
{ default: transformer, parser: 'tsx' },
|
|
85
|
+
{},
|
|
86
|
+
`
|
|
87
87
|
import { AkCode as CodeComponent } from '@atlaskit/code';
|
|
88
88
|
|
|
89
89
|
const Component = () => <CodeComponent prop="abc" />;
|
|
90
90
|
`,
|
|
91
|
-
|
|
91
|
+
`
|
|
92
92
|
import { Code as CodeComponent } from '@atlaskit/code';
|
|
93
93
|
|
|
94
94
|
const Component = () => <CodeComponent prop="abc" />;
|
|
95
95
|
`,
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
`transforms import name "AkCode" to "Code" with some other name along with its usage`,
|
|
97
|
+
);
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
defineInlineTest(
|
|
100
|
+
{ default: transformer, parser: 'tsx' },
|
|
101
|
+
{},
|
|
102
|
+
`
|
|
103
103
|
import { AkCode } from '@atlaskit/code';
|
|
104
104
|
|
|
105
105
|
const Code = () => <AkCode prop="abc" />;
|
|
106
106
|
`,
|
|
107
|
-
|
|
107
|
+
`
|
|
108
108
|
import { Code as AkCode } from '@atlaskit/code';
|
|
109
109
|
|
|
110
110
|
const Code = () => <AkCode prop="abc" />;
|
|
111
111
|
`,
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
`transforms import name "AkCode" to "Code" by renaming its imported name when "Code" variable declaration is already present`,
|
|
113
|
+
);
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
defineInlineTest(
|
|
116
|
+
{ default: transformer, parser: 'tsx' },
|
|
117
|
+
{},
|
|
118
|
+
`
|
|
119
119
|
import { AkCode } from '@atlaskit/code';
|
|
120
120
|
|
|
121
121
|
function Code () { return <AkCode prop="abc" /> };
|
|
122
122
|
`,
|
|
123
|
-
|
|
123
|
+
`
|
|
124
124
|
import { Code as AkCode } from '@atlaskit/code';
|
|
125
125
|
|
|
126
126
|
function Code () { return <AkCode prop="abc" /> };
|
|
127
127
|
`,
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
`transforms import name "AkCode" to "Code" by renaming its imported name when "Code" function declaration is already present`,
|
|
129
|
+
);
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
defineInlineTest(
|
|
132
|
+
{ default: transformer, parser: 'tsx' },
|
|
133
|
+
{},
|
|
134
|
+
`
|
|
135
135
|
import { AkCode } from '@atlaskit/code';
|
|
136
136
|
|
|
137
137
|
class Code { render() { return <AkCode prop="abc" /> } };
|
|
138
138
|
`,
|
|
139
|
-
|
|
139
|
+
`
|
|
140
140
|
import { Code as AkCode } from '@atlaskit/code';
|
|
141
141
|
|
|
142
142
|
class Code { render() { return <AkCode prop="abc" /> } };
|
|
143
143
|
`,
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
`transforms import name "AkCode" to "Code" by renaming its imported name when "Code" class declaration is already present`,
|
|
145
|
+
);
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
defineInlineTest(
|
|
148
|
+
{ default: transformer, parser: 'tsx' },
|
|
149
|
+
{},
|
|
150
|
+
`
|
|
151
151
|
import React from 'react';
|
|
152
152
|
import { AkCode } from '@atlaskit/code';
|
|
153
153
|
import Code from './component';
|
|
154
154
|
|
|
155
155
|
class Component extends React.Component { render() { return <AkCode prop="abc" /> } };
|
|
156
156
|
`,
|
|
157
|
-
|
|
157
|
+
`
|
|
158
158
|
import React from 'react';
|
|
159
159
|
import { Code as AkCode } from '@atlaskit/code';
|
|
160
160
|
import Code from './component';
|
|
161
161
|
|
|
162
162
|
class Component extends React.Component { render() { return <AkCode prop="abc" /> } };
|
|
163
163
|
`,
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
`transforms import name "AkCode" to "Code" by renaming its imported name when "Code" import declaration is already present`,
|
|
165
|
+
);
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
defineInlineTest(
|
|
168
|
+
{ default: transformer, parser: 'tsx' },
|
|
169
|
+
{},
|
|
170
|
+
`
|
|
171
171
|
const Code = lazy(() =>
|
|
172
172
|
import('@atlaskit/code').then(module => ({
|
|
173
173
|
default: module.AkCode,
|
|
174
174
|
})),
|
|
175
175
|
);
|
|
176
176
|
`,
|
|
177
|
-
|
|
177
|
+
`
|
|
178
178
|
const Code = lazy(() =>
|
|
179
179
|
import('@atlaskit/code').then(module => ({
|
|
180
180
|
AkCode: module.Code,
|
|
@@ -184,31 +184,31 @@ describe('Rename imports', () => {
|
|
|
184
184
|
})),
|
|
185
185
|
);
|
|
186
186
|
`,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
187
|
+
`transforms dynamic import name "AkCode" to "Code"`,
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
describe('#AkCodeBlock import', () => {
|
|
192
|
+
defineInlineTest(
|
|
193
|
+
{ default: transformer, parser: 'tsx' },
|
|
194
|
+
{},
|
|
195
|
+
`import { AkCodeBlock } from '@atlaskit/code';`,
|
|
196
|
+
`import { CodeBlock } from '@atlaskit/code';`,
|
|
197
|
+
`transforms import name "AkCodeBlock" to "CodeBlock"`,
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
defineInlineTest(
|
|
201
|
+
{ default: transformer, parser: 'tsx' },
|
|
202
|
+
{},
|
|
203
|
+
`import { AkCodeBlock as CodeBlockComponent } from '@atlaskit/code';`,
|
|
204
|
+
`import { CodeBlock as CodeBlockComponent } from '@atlaskit/code';`,
|
|
205
|
+
`transforms import name "AkCodeBlock" with some other name to "CodeBlock"`,
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
defineInlineTest(
|
|
209
|
+
{ default: transformer, parser: 'tsx' },
|
|
210
|
+
{},
|
|
211
|
+
`
|
|
212
212
|
import React from 'react';
|
|
213
213
|
import { AkCodeBlock } from '@atlaskit/code';
|
|
214
214
|
|
|
@@ -230,7 +230,7 @@ describe('Rename imports', () => {
|
|
|
230
230
|
AkCodeBlock: () => null,
|
|
231
231
|
};
|
|
232
232
|
`,
|
|
233
|
-
|
|
233
|
+
`
|
|
234
234
|
import React from 'react';
|
|
235
235
|
import { CodeBlock } from '@atlaskit/code';
|
|
236
236
|
|
|
@@ -252,104 +252,104 @@ describe('Rename imports', () => {
|
|
|
252
252
|
AkCodeBlock: () => null,
|
|
253
253
|
};
|
|
254
254
|
`,
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
`transforms import name "AkCodeBlock" to "CodeBlock" along with its usage`,
|
|
256
|
+
);
|
|
257
257
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
defineInlineTest(
|
|
259
|
+
{ default: transformer, parser: 'tsx' },
|
|
260
|
+
{},
|
|
261
|
+
`
|
|
262
262
|
import { AkCodeBlock as CodeBlockComponent } from '@atlaskit/code';
|
|
263
263
|
|
|
264
264
|
const Component = () => <CodeBlockComponent prop="abc" />;
|
|
265
265
|
`,
|
|
266
|
-
|
|
266
|
+
`
|
|
267
267
|
import { CodeBlock as CodeBlockComponent } from '@atlaskit/code';
|
|
268
268
|
|
|
269
269
|
const Component = () => <CodeBlockComponent prop="abc" />;
|
|
270
270
|
`,
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
`transforms import name "AkCodeBlock" to "CodeBlock" with some other name along with its usage`,
|
|
272
|
+
);
|
|
273
273
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
defineInlineTest(
|
|
275
|
+
{ default: transformer, parser: 'tsx' },
|
|
276
|
+
{},
|
|
277
|
+
`
|
|
278
278
|
import { AkCodeBlock } from '@atlaskit/code';
|
|
279
279
|
|
|
280
280
|
const CodeBlock = () => <AkCodeBlock prop="abc" />;
|
|
281
281
|
`,
|
|
282
|
-
|
|
282
|
+
`
|
|
283
283
|
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
284
284
|
|
|
285
285
|
const CodeBlock = () => <AkCodeBlock prop="abc" />;
|
|
286
286
|
`,
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
`transforms import name "AkCodeBlock" to "CodeBlock" by renaming its imported name when "CodeBlock" variable declaration is already present`,
|
|
288
|
+
);
|
|
289
289
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
defineInlineTest(
|
|
291
|
+
{ default: transformer, parser: 'tsx' },
|
|
292
|
+
{},
|
|
293
|
+
`
|
|
294
294
|
import { AkCodeBlock } from '@atlaskit/code';
|
|
295
295
|
|
|
296
296
|
function CodeBlock () { return <AkCodeBlock prop="abc" /> };
|
|
297
297
|
`,
|
|
298
|
-
|
|
298
|
+
`
|
|
299
299
|
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
300
300
|
|
|
301
301
|
function CodeBlock () { return <AkCodeBlock prop="abc" /> };
|
|
302
302
|
`,
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
`transforms import name "AkCodeBlock" to "CodeBlock" by renaming its imported name when "CodeBlock" function declaration is already present`,
|
|
304
|
+
);
|
|
305
305
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
306
|
+
defineInlineTest(
|
|
307
|
+
{ default: transformer, parser: 'tsx' },
|
|
308
|
+
{},
|
|
309
|
+
`
|
|
310
310
|
import React from 'react';
|
|
311
311
|
import { AkCodeBlock } from '@atlaskit/code';
|
|
312
312
|
|
|
313
313
|
class CodeBlock extends React.Component { render() { return <AkCodeBlock prop="abc" /> } };
|
|
314
314
|
`,
|
|
315
|
-
|
|
315
|
+
`
|
|
316
316
|
import React from 'react';
|
|
317
317
|
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
318
318
|
|
|
319
319
|
class CodeBlock extends React.Component { render() { return <AkCodeBlock prop="abc" /> } };
|
|
320
320
|
`,
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
`transforms import name "AkCodeBlock" to "CodeBlock" by renaming its imported name when "CodeBlock" class declaration is already present`,
|
|
322
|
+
);
|
|
323
323
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
defineInlineTest(
|
|
325
|
+
{ default: transformer, parser: 'tsx' },
|
|
326
|
+
{},
|
|
327
|
+
`
|
|
328
328
|
import { AkCodeBlock } from '@atlaskit/code';
|
|
329
329
|
import CodeBlock from './component';
|
|
330
330
|
|
|
331
331
|
class Component { render() { return <AkCodeBlock prop="abc" /> } };
|
|
332
332
|
`,
|
|
333
|
-
|
|
333
|
+
`
|
|
334
334
|
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
335
335
|
import CodeBlock from './component';
|
|
336
336
|
|
|
337
337
|
class Component { render() { return <AkCodeBlock prop="abc" /> } };
|
|
338
338
|
`,
|
|
339
|
-
|
|
340
|
-
|
|
339
|
+
`transforms import name "AkCodeBlock" to "CodeBlock" by renaming its imported name when "CodeBlock" import declaration is already present`,
|
|
340
|
+
);
|
|
341
341
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
defineInlineTest(
|
|
343
|
+
{ default: transformer, parser: 'tsx' },
|
|
344
|
+
{},
|
|
345
|
+
`
|
|
346
346
|
const CodeBlock = lazy(() =>
|
|
347
347
|
import('@atlaskit/code').then(module => ({
|
|
348
348
|
default: module.AkCodeBlock,
|
|
349
349
|
})),
|
|
350
350
|
);
|
|
351
351
|
`,
|
|
352
|
-
|
|
352
|
+
`
|
|
353
353
|
const CodeBlock = lazy(() =>
|
|
354
354
|
import('@atlaskit/code').then(module => ({
|
|
355
355
|
AkCode: module.Code,
|
|
@@ -359,7 +359,7 @@ describe('Rename imports', () => {
|
|
|
359
359
|
})),
|
|
360
360
|
);
|
|
361
361
|
`,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
`transforms dynamic import name "AkCodeBlock" to "CodeBlock"`,
|
|
363
|
+
);
|
|
364
|
+
});
|
|
365
365
|
});
|
|
@@ -5,10 +5,10 @@ import { comment } from './remove-language';
|
|
|
5
5
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
6
|
|
|
7
7
|
describe('all transforms should be applied', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
defineInlineTest(
|
|
9
|
+
{ default: transformer, parser: 'tsx' },
|
|
10
|
+
{},
|
|
11
|
+
`
|
|
12
12
|
import React from 'react';
|
|
13
13
|
|
|
14
14
|
import { Code } from '@atlaskit/code';
|
|
@@ -25,7 +25,7 @@ describe('all transforms should be applied', () => {
|
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
`,
|
|
28
|
-
|
|
28
|
+
`
|
|
29
29
|
${comment}
|
|
30
30
|
import React from 'react';
|
|
31
31
|
|
|
@@ -43,13 +43,13 @@ describe('all transforms should be applied', () => {
|
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
`,
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
'should remove language prop if it is a string and convert text to be a child if it is a variable',
|
|
47
|
+
);
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
defineInlineTest(
|
|
50
|
+
{ default: transformer, parser: 'tsx' },
|
|
51
|
+
{},
|
|
52
|
+
`
|
|
53
53
|
import React from 'react';
|
|
54
54
|
|
|
55
55
|
import { Code as AkCode } from '@atlaskit/code';
|
|
@@ -66,7 +66,7 @@ describe('all transforms should be applied', () => {
|
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
`,
|
|
69
|
-
|
|
69
|
+
`
|
|
70
70
|
${comment}
|
|
71
71
|
import React from 'react';
|
|
72
72
|
|
|
@@ -84,13 +84,13 @@ describe('all transforms should be applied', () => {
|
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
`,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
'should remove language prop if it is a variable and text to be a child if it is a string and code is aliased',
|
|
88
|
+
);
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
defineInlineTest(
|
|
91
|
+
{ default: transformer, parser: 'tsx' },
|
|
92
|
+
{},
|
|
93
|
+
`
|
|
94
94
|
import React from 'react';
|
|
95
95
|
|
|
96
96
|
import { Code } from '@atlaskit/code';
|
|
@@ -108,7 +108,7 @@ describe('all transforms should be applied', () => {
|
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
`,
|
|
111
|
-
|
|
111
|
+
`
|
|
112
112
|
${comment}
|
|
113
113
|
import React from 'react';
|
|
114
114
|
|
|
@@ -127,13 +127,13 @@ describe('all transforms should be applied', () => {
|
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
`,
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
'should remove language prop if it is a variable and text to be a child and not change other props',
|
|
131
|
+
);
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
defineInlineTest(
|
|
134
|
+
{ default: transformer, parser: 'tsx' },
|
|
135
|
+
{},
|
|
136
|
+
`
|
|
137
137
|
import React from 'react';
|
|
138
138
|
|
|
139
139
|
import { Code } from '@atlaskit/code';
|
|
@@ -153,7 +153,7 @@ describe('all transforms should be applied', () => {
|
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
`,
|
|
156
|
-
|
|
156
|
+
`
|
|
157
157
|
${comment}
|
|
158
158
|
import React from 'react';
|
|
159
159
|
|
|
@@ -174,13 +174,13 @@ describe('all transforms should be applied', () => {
|
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
176
|
`,
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
'should remove language prop if it is a variable and text to be a child if it is a variable with other props',
|
|
178
|
+
);
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
defineInlineTest(
|
|
181
|
+
{ default: transformer, parser: 'tsx' },
|
|
182
|
+
{},
|
|
183
|
+
`
|
|
184
184
|
import React from 'react';
|
|
185
185
|
|
|
186
186
|
import { Code } from '@atlaskit/code';
|
|
@@ -195,7 +195,7 @@ describe('all transforms should be applied', () => {
|
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
197
|
`,
|
|
198
|
-
|
|
198
|
+
`
|
|
199
199
|
${comment}
|
|
200
200
|
import React from 'react';
|
|
201
201
|
|
|
@@ -211,6 +211,6 @@ describe('all transforms should be applied', () => {
|
|
|
211
211
|
);
|
|
212
212
|
}
|
|
213
213
|
`,
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
'should remove language prop and convert to children if code is inline',
|
|
215
|
+
);
|
|
216
216
|
});
|
|
@@ -15,10 +15,10 @@ export const comment = `/* TODO: (from codemod)
|
|
|
15
15
|
|
|
16
16
|
// TODO come up with a comment here
|
|
17
17
|
describe('remove language prop', () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
defineInlineTest(
|
|
19
|
+
{ default: transformer, parser: 'tsx' },
|
|
20
|
+
{},
|
|
21
|
+
`
|
|
22
22
|
import React from 'react';
|
|
23
23
|
|
|
24
24
|
import { Code } from '@atlaskit/code';
|
|
@@ -33,7 +33,7 @@ describe('remove language prop', () => {
|
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
`,
|
|
36
|
-
|
|
36
|
+
`
|
|
37
37
|
${comment}
|
|
38
38
|
import React from 'react';
|
|
39
39
|
|
|
@@ -49,13 +49,13 @@ describe('remove language prop', () => {
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
`,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
'should remove language prop if it is a string',
|
|
53
|
+
);
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
defineInlineTest(
|
|
56
|
+
{ default: transformer, parser: 'tsx' },
|
|
57
|
+
{},
|
|
58
|
+
`
|
|
59
59
|
import React from 'react';
|
|
60
60
|
|
|
61
61
|
import { Code } from '@atlaskit/code';
|
|
@@ -72,7 +72,7 @@ describe('remove language prop', () => {
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
`,
|
|
75
|
-
|
|
75
|
+
`
|
|
76
76
|
${comment}
|
|
77
77
|
import React from 'react';
|
|
78
78
|
|
|
@@ -90,13 +90,13 @@ describe('remove language prop', () => {
|
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
`,
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
'should remove language prop if it is a variable',
|
|
94
|
+
);
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
defineInlineTest(
|
|
97
|
+
{ default: transformer, parser: 'tsx' },
|
|
98
|
+
{},
|
|
99
|
+
`
|
|
100
100
|
import React from 'react';
|
|
101
101
|
|
|
102
102
|
import { Code } from '@atlaskit/code';
|
|
@@ -111,7 +111,7 @@ describe('remove language prop', () => {
|
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
`,
|
|
114
|
-
|
|
114
|
+
`
|
|
115
115
|
import React from 'react';
|
|
116
116
|
|
|
117
117
|
import { Code } from '@atlaskit/code';
|
|
@@ -126,6 +126,6 @@ describe('remove language prop', () => {
|
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
`,
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
'should not do anything if language prop is not defined',
|
|
130
|
+
);
|
|
131
131
|
});
|