mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-16 01:41:02 +08:00
ee50fe7952
* refactor(upload): rewrite with hooks * refactor: optimize code style; chore(dragger): add forwardRef; * fix: lint * fix: trigger ci * fix: lint * chore: add test case
39 lines
966 B
JavaScript
39 lines
966 B
JavaScript
/* eslint-disable react/no-string-refs, react/prefer-es6-class */
|
|
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import { act } from 'react-dom/test-utils';
|
|
import Upload from '..';
|
|
import { setup, teardown } from './mock';
|
|
import mountTest from '../../../tests/shared/mountTest';
|
|
|
|
describe('Upload.Dragger', () => {
|
|
mountTest(Upload.Dragger);
|
|
|
|
beforeEach(() => setup());
|
|
afterEach(() => teardown());
|
|
|
|
it('support drag file with over style', () => {
|
|
jest.useFakeTimers();
|
|
const wrapper = mount(
|
|
<Upload.Dragger action="http://upload.com">
|
|
<div />
|
|
</Upload.Dragger>,
|
|
);
|
|
|
|
wrapper.find('.ant-upload-drag-container').simulate('dragover', {
|
|
target: {
|
|
files: [{ file: 'foo.png' }],
|
|
},
|
|
});
|
|
|
|
act(() => {
|
|
jest.runAllTimers();
|
|
});
|
|
wrapper.update();
|
|
|
|
expect(wrapper.find('.ant-upload-drag').hasClass('ant-upload-drag-hover')).toBe(true);
|
|
|
|
jest.useRealTimers();
|
|
});
|
|
});
|