-
-
Notifications
You must be signed in to change notification settings - Fork 252
/
Copy pathPrivate.spec.tsx
44 lines (40 loc) · 1.14 KB
/
Private.spec.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
/* eslint-disable no-undef */
import { render } from '@testing-library/react';
import classnames from 'classnames';
import React from 'react';
import Menu, { MenuItem, SubMenu } from '../src';
describe('Private Props', () => {
it('_internalRenderMenuItem', () => {
const { container } = render(
<Menu
_internalRenderMenuItem={node =>
React.cloneElement(node, {
className: classnames(node.props.className, 'inject-cls'),
})
}
>
<MenuItem key="1">1</MenuItem>
</Menu>,
);
expect(container.querySelector('.inject-cls')).toBeTruthy();
});
it('_internalRenderSubMenuItem', () => {
const { container } = render(
<Menu
mode="inline"
openKeys={['1']}
_internalRenderSubMenuItem={node =>
React.cloneElement(node, {
className: classnames(node.props.className, 'inject-cls'),
})
}
>
<SubMenu key="1" title="1">
<MenuItem key="1-1">1-1</MenuItem>
</SubMenu>
</Menu>,
);
expect(container.querySelector('.inject-cls')).toBeTruthy();
});
});
/* eslint-enable */