/
UI.tsx
31 lines (26 loc) 路 819 Bytes
/
UI.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
import * as React from 'react';
import {configure, mount} from 'enzyme';
import * as Adapter from 'enzyme-adapter-react-16';
import {RemoveScroll} from '../src/UI';
import {sidecar} from "use-sidecar";
configure({adapter: new Adapter()});
const tick = () => new Promise(resolve => setTimeout(resolve, 10));
const car = sidecar(() => import ('../src/sidecar'));
describe('UI', () => {
it('smoke', async () => {
const wrapper = mount(
<RemoveScroll sideCar={car}>content</RemoveScroll>
);
await tick();
expect(wrapper.html()).toContain('content');
});
it('forward', async () => {
const wrapper = mount(
<RemoveScroll sideCar={car} forwardProps>
<div>content</div>
</RemoveScroll>
);
await tick();
expect(wrapper.html()).toContain('content');
});
});