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