('div.ant-space-item')[1]?.style.marginBottom,
).toBe('');
});
it('should render correct with children', () => {
const { container } = render(
text1text1
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<>text3>
,
);
expect(container.children[0]).toMatchSnapshot();
});
it('should render with invalidElement', () => {
const { container } = render(
text1text1
text1
,
);
expect(container.querySelectorAll('div.ant-space-item').length).toBe(3);
});
it('should be keep store', () => {
function Demo() {
const [state, setState] = React.useState(1);
return (
{
setState(value => value + 1);
}}
>
{state}
);
}
function SpaceDemo() {
const [visible, setVisible] = useState(true);
function onChange() {
setVisible(!visible);
}
return (
{visible && space
}
Three
);
}
const { container } = render();
expect(container.querySelector('#demo')).toHaveTextContent('1');
fireEvent.click(container.querySelector('#demo')!);
expect(container.querySelector('#demo')).toHaveTextContent('2');
fireEvent.click(container.querySelector('p')!);
expect(container.querySelector('#demo')).toHaveTextContent('2');
});
it('split', () => {
const { container } = render(
text1text1
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<>text3>
,
);
expect(container.children[0]).toMatchSnapshot();
});
// https://github.com/ant-design/ant-design/issues/35305
it('should not throw duplicated key warning', () => {
jest.spyOn(console, 'error').mockImplementation(() => undefined);
render(
,
);
expect(console.error).not.toHaveBeenCalledWith(
expect.stringContaining('Encountered two children with the same key'),
expect.anything(),
expect.anything(),
);
(console.error as any).mockRestore();
});
});