We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a67c0d2 commit 0b4a968Copy full SHA for 0b4a968
components/skeleton/Skeleton.tsx
@@ -161,7 +161,7 @@ const Skeleton = (props: SkeletonProps) => {
161
</div>
162
);
163
}
164
- return children as React.ReactElement;
+ return children ? children as React.ReactElement : null;
165
};
166
167
Skeleton.defaultProps = {
components/skeleton/__tests__/index.test.js
@@ -34,6 +34,11 @@ describe('Skeleton', () => {
34
expect(wrapperSmall.render()).toMatchSnapshot();
35
});
36
37
+ it('should display without children', () => {
38
+ const wrapper = mount(<Skeleton loading={false}></Skeleton>);
39
+ expect(wrapper.render()).toMatchSnapshot();
40
+ });
41
+
42
it('should display children', () => {
43
const wrapper = mount(<Skeleton loading={false}>{[1, 2, 3]}</Skeleton>);
44
expect(wrapper.text()).toBe('123');
0 commit comments