Skip to content

Commit a3b40eb

Browse files
committed
Improve tests for codemod
1 parent 60ea322 commit a3b40eb

File tree

2 files changed

+36
-8
lines changed

2 files changed

+36
-8
lines changed
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
<Autocomplete
2-
components={{ Root, Input: CustomInput }}
3-
componentsProps={{ root: { className: 'root' }, input: { 'data-testid': 'input' } }}
4-
/>;
1+
// the codemod should transform only Joy UI components;
2+
import { Alert as JoyAlert } from '@mui/joy';
3+
import JoyAutocomplete from '@mui/joy/Autocomplete';
4+
import CustomComponent from 'components/Custom';
5+
6+
<div>
7+
<JoyAlert
8+
components={{ Root, Input: CustomInput }}
9+
componentsProps={{ root: { className: 'root' }, input: { 'data-testid': 'input' } }}
10+
/>
11+
<JoyAutocomplete
12+
components={{ Root, Input: CustomInput }}
13+
componentsProps={{ root: { className: 'root' }, input: { 'data-testid': 'input' } }}
14+
/>
15+
<CustomComponent
16+
componentsProps={{ root: { className: 'root' }, input: { 'data-testid': 'input' } }}
17+
/>
18+
</div>;
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
<Autocomplete
2-
slots={{ root: Root, input: CustomInput }}
3-
slotProps={{ root: { className: 'root' }, input: { 'data-testid': 'input' } }}
4-
/>;
1+
// the codemod should transform only Joy UI slots;
2+
import { Alert as JoyAlert } from '@mui/joy';
3+
import JoyAutocomplete from '@mui/joy/Autocomplete';
4+
import CustomComponent from 'components/Custom';
5+
6+
<div>
7+
<JoyAlert
8+
slots={{ Root, Input: CustomInput }}
9+
slotProps={{ root: { className: 'root' }, input: { 'data-testid': 'input' } }}
10+
/>
11+
<JoyAutocomplete
12+
slots={{ Root, Input: CustomInput }}
13+
slotProps={{ root: { className: 'root' }, input: { 'data-testid': 'input' } }}
14+
/>
15+
<CustomComponent
16+
slotProps={{ root: { className: 'root' }, input: { 'data-testid': 'input' } }}
17+
/>
18+
</div>;

0 commit comments

Comments
 (0)