mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 18:09:22 +08:00
21 lines
463 B
JavaScript
21 lines
463 B
JavaScript
import { mount } from 'enzyme';
|
|
import React from 'react';
|
|
import useMounted from '../hooks/useMounted';
|
|
|
|
describe('useMounted', () => {
|
|
it('should work properly', () => {
|
|
let isMounted = null;
|
|
|
|
const AutoUnmounted = () => {
|
|
isMounted = useMounted();
|
|
|
|
return <div>Mounted</div>;
|
|
};
|
|
|
|
const wrapper = mount(<AutoUnmounted />);
|
|
expect(isMounted()).toBeTruthy();
|
|
wrapper.unmount();
|
|
expect(isMounted()).toBeFalsy();
|
|
});
|
|
});
|