ant-design/components/grid/__tests__/server.test.tsx
lijianan 6a5e7ded43
refactor: remove Space & Grid IE compatible logic (#44620)
* refactor: remove IE compatible logic

* fix: fix

* fix: fix

* fix: fix
2023-09-05 10:17:56 +08:00

27 lines
1.1 KiB
TypeScript

import React from 'react';
import { Col, Row } from '..';
import { render } from '../../../tests/utils';
jest.mock('rc-util/lib/Dom/canUseDom', () => () => false);
describe('Grid.Server', () => {
it('use compatible gap logic', () => {
const { container } = render(
<Row gutter={[8, 16]}>
<Col />
</Row>,
);
expect((container.querySelector('.ant-row') as HTMLElement)?.style.marginLeft).toBe('-4px');
expect((container.querySelector('.ant-row') as HTMLElement)?.style.marginRight).toBe('-4px');
expect((container.querySelector('.ant-row') as HTMLElement)?.style.marginTop).toBe('');
expect((container.querySelector('.ant-row') as HTMLElement)?.style.marginBottom).toBe('');
expect((container.querySelector('.ant-col') as HTMLElement)?.style.paddingLeft).toBe('4px');
expect((container.querySelector('.ant-col') as HTMLElement)?.style.paddingRight).toBe('4px');
expect((container.querySelector('.ant-col') as HTMLElement)?.style.paddingTop).toBe('');
expect((container.querySelector('.ant-col') as HTMLElement)?.style.paddingBottom).toBe('');
});
});