Skip to content

Commit 2923f88

Browse files
committed
text(WingBlank): 添加测试用力
1 parent 992dcea commit 2923f88

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

packages/core/src/WingBlank/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class WingBlank extends Component<WingBlankProps> {
2020
} else if (size && styles[size]) {
2121
sizeStyle = styles[size];
2222
}
23-
return <View {...restProps} style={[sizeStyle, style]} />;
23+
return <View testID="RNE__WingBlank__view" {...restProps} style={[sizeStyle, style]} />;
2424
}
2525
}
2626

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import 'react-native';
2+
import React from 'react';
3+
import WingBlank from '../lib/WingBlank';
4+
import { render } from '@testing-library/react-native';
5+
import { keys, toObject } from '../utils';
6+
7+
const SIZE: keys = {
8+
small: 6,
9+
default: 12,
10+
large: 16,
11+
};
12+
13+
describe('WingBlank', () => {
14+
describe.each`
15+
size
16+
${'small'}
17+
${'default'}
18+
${'large'}
19+
`('$size', ({ size }) => {
20+
it(`should display size ${size} wingBlank`, () => {
21+
const { getByTestId } = render(<WingBlank size={size} />);
22+
const component = getByTestId('RNE__WingBlank__view');
23+
const styles = toObject(component.props.style);
24+
expect(styles.marginHorizontal).toBe(SIZE[size]);
25+
});
26+
});
27+
});

0 commit comments

Comments
 (0)