fix(space): fix ant-space-item selector (#40554)

This commit is contained in:
Yanlin Jiang 2023-02-05 19:58:29 +08:00 committed by GitHub
parent cffd1e63d4
commit 8a5cbf330c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -197,4 +197,17 @@ describe('Space', () => {
);
spy.mockRestore();
});
it('should render the hidden empty item wrapper', () => {
const Null = () => null;
const { container } = render(
<Space>
<Null />
</Space>,
);
const item = container.querySelector('div.ant-space-item') as HTMLElement;
expect(item).toBeEmptyDOMElement();
expect(getComputedStyle(item).display).toBe('none');
});
});

View File

@ -38,7 +38,7 @@ const genSpaceStyle: GenerateStyle<SpaceToken> = (token) => {
alignItems: 'baseline',
},
},
[`${componentCls}-space-item`]: {
[`${componentCls}-item`]: {
'&:empty': {
display: 'none',
},