-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Grid.test.tsx
47 lines (43 loc) · 1.08 KB
/
Grid.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from 'react';
import { render } from '@testing-library/react';
import { itSupportsSystemProps } from '@mantine/tests';
import { Grid, GridProps } from './Grid';
import { Col } from './Col/Col';
const defaultProps: GridProps = {
children: (
<>
<Grid.Col>1</Grid.Col>
<Grid.Col>2</Grid.Col>
</>
),
};
describe('@mantine/core/Grid', () => {
itSupportsSystemProps({
component: Grid,
props: defaultProps,
displayName: '@mantine/core/Grid',
refType: HTMLDivElement,
providerName: 'Grid',
});
it('exposes Col as Grid.Col', () => {
expect(Grid.Col).toBe(Col);
});
it('supports getting Grid ref', () => {
const ref = React.createRef<HTMLDivElement>();
render(
<Grid ref={ref}>
<Grid.Col />
</Grid>
);
expect(ref.current instanceof HTMLDivElement).toBe(true);
});
it('supports getting Col ref', () => {
const ref = React.createRef<HTMLDivElement>();
render(
<Grid>
<Grid.Col ref={ref} />
</Grid>
);
expect(ref.current instanceof HTMLDivElement).toBe(true);
});
});