Skip to content

Commit 6d29f43

Browse files
committed
fix: scrap warn
1 parent 349a0d2 commit 6d29f43

3 files changed

Lines changed: 2 additions & 55 deletions

File tree

src/components/Badge.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,12 @@ export type Props = React.ComponentProps<typeof Animated.Text> & {
5353
*/
5454
const Badge = ({
5555
children,
56-
size,
56+
size: _size,
5757
style,
5858
theme: themeOverrides,
5959
visible = true,
6060
...rest
6161
}: Props) => {
62-
if (process.env.NODE_ENV !== 'production' && size !== undefined) {
63-
console.warn(
64-
'Badge: the `size` prop is deprecated and has no effect. Badge size is determined automatically by MD3 variant.'
65-
);
66-
}
6762
const theme = useInternalTheme(themeOverrides);
6863
const { current: opacity } = React.useRef<Animated.Value>(
6964
new Animated.Value(visible ? 1 : 0)

src/components/__tests__/Badge.test.tsx

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, it, jest } from '@jest/globals';
1+
import { expect, it } from '@jest/globals';
22

33
import { render, screen } from '../../test-utils';
44
import { red500 } from '../../theme/colors';
@@ -64,21 +64,3 @@ it('does not apply typography or padding to dot badge', async () => {
6464
expect(screen.getByTestId('badge')).not.toHaveStyle({ paddingHorizontal: 4 });
6565
expect(screen.getByTestId('badge')).not.toHaveStyle({ fontSize: 11 });
6666
});
67-
68-
it('renders badge with deprecated size prop (size is ignored)', async () => {
69-
const tree = (await render(<Badge size={12}>3</Badge>)).toJSON();
70-
71-
expect(tree).toMatchSnapshot();
72-
});
73-
74-
it('warns when deprecated size prop is used', async () => {
75-
jest.spyOn(console, 'warn').mockImplementation(() => {});
76-
77-
await render(<Badge size={12}>3</Badge>);
78-
79-
expect(console.warn).toHaveBeenCalledWith(
80-
'Badge: the `size` prop is deprecated and has no effect. Badge size is determined automatically by MD3 variant.'
81-
);
82-
83-
jest.restoreAllMocks();
84-
});

src/components/__tests__/__snapshots__/Badge.test.tsx.snap

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -110,33 +110,3 @@ exports[`renders badge with content 1`] = `
110110
3
111111
</Text>
112112
`;
113-
114-
exports[`renders badge with deprecated size prop (size is ignored) 1`] = `
115-
<Text
116-
collapsable={false}
117-
numberOfLines={1}
118-
style={
119-
{
120-
"alignSelf": "flex-end",
121-
"backgroundColor": "rgba(179, 38, 30, 1)",
122-
"borderRadius": 9999,
123-
"color": "rgba(255, 255, 255, 1)",
124-
"fontFamily": "System",
125-
"fontSize": 11,
126-
"fontWeight": "500",
127-
"height": 16,
128-
"letterSpacing": 0.5,
129-
"lineHeight": 16,
130-
"maxWidth": 34,
131-
"minWidth": 16,
132-
"opacity": 1,
133-
"overflow": "hidden",
134-
"paddingHorizontal": 4,
135-
"textAlign": "center",
136-
"textAlignVertical": "center",
137-
}
138-
}
139-
>
140-
3
141-
</Text>
142-
`;

0 commit comments

Comments
 (0)