Skip to content

Commit

Permalink
test: cover wrapping siblings individually in inverted codemod
Browse files Browse the repository at this point in the history
  • Loading branch information
Martí Malek committed Oct 31, 2023
1 parent a6f440b commit 755d9da
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Button, Box } from '@freenow/wave';

interface Props {
label: string;
disabled?: boolean;
onClick: () => void;
}

export const ActionItem = ({ label, onClick }: Props): JSX.Element => (
<Box>
<Button inverted size="small" onClick={onClick}>
{label}
</Button>
<Button inverted size="small" onClick={onClick}>
{label}
</Button>
</Box>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Button, Box, InvertedColorScheme } from '@freenow/wave';

interface Props {
label: string;
disabled?: boolean;
onClick: () => void;
}

export const ActionItem = ({ label, onClick }: Props): JSX.Element => (
<Box>
<InvertedColorScheme>
<Button size="small" onClick={onClick}>
{label}
</Button>
</InvertedColorScheme>
<InvertedColorScheme>
<Button size="small" onClick={onClick}>
{label}
</Button>
</InvertedColorScheme>
</Box>
);
8 changes: 7 additions & 1 deletion src/codemods/__tests__/inverted-to-wrapper-test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
jest.autoMockOff();
const { defineTest } = require('jscodeshift/dist/testUtils');

const tests = ['local-rename', 'explicit-boolean-false', 'explicit-boolean-true', 'styled-rename'];
const tests = [
'local-rename',
'explicit-boolean-false',
'explicit-boolean-true',
'styled-rename',
'individual-wrap-siblings'
];

describe('inverted-to-wrapper', () => {
tests.forEach(test =>
Expand Down

0 comments on commit 755d9da

Please sign in to comment.