@@ -18556,7 +18569,20 @@ exports[`ConfigProvider components Upload normal 1`] = `
>
+ >
+
+
+
+
+
@@ -18668,7 +18694,20 @@ exports[`ConfigProvider components Upload prefixCls 1`] = `
>
+ >
+
+
+
+
+
diff --git a/components/config-provider/__tests__/components.test.js b/components/config-provider/__tests__/components.test.js
index 327a4ebc60..7123718635 100644
--- a/components/config-provider/__tests__/components.test.js
+++ b/components/config-provider/__tests__/components.test.js
@@ -54,7 +54,6 @@ import Tree from '../../tree';
import TreeSelect from '../../tree-select';
import Upload from '../../upload';
-jest.mock('draft-js/lib/generateRandomKey', () => () => '123');
jest.mock('rc-util/lib/Portal');
describe('ConfigProvider', () => {
diff --git a/components/descriptions/__tests__/index.test.js b/components/descriptions/__tests__/index.test.js
index d141e2596b..6e745708e9 100644
--- a/components/descriptions/__tests__/index.test.js
+++ b/components/descriptions/__tests__/index.test.js
@@ -5,29 +5,20 @@ import Descriptions from '..';
import mountTest from '../../../tests/shared/mountTest';
import { resetWarned } from '../../_util/warning';
-jest.mock('enquire.js', () => {
- let that;
- let unmatchFun;
- return {
- unregister: jest.fn(),
- register: (media, options) => {
- if (media === '(max-width: 575px)') {
- that = this;
- options.match.call(that);
- unmatchFun = options.unmatch;
- }
- },
- callunmatch() {
- unmatchFun.call(that);
- },
- };
-});
-
describe('Descriptions', () => {
mountTest(Descriptions);
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
+ jest.spyOn(window, 'matchMedia').mockImplementationOnce(query => ({
+ addListener: (listener) => {
+ if (query === '(max-width: 575px)') {
+ listener({ matches: true });
+ }
+ },
+ removeListener: jest.fn(),
+ }));
+
afterEach(() => {
MockDate.reset();
errorSpy.mockReset();
@@ -38,8 +29,6 @@ describe('Descriptions', () => {
});
it('when max-width: 575px,column=1', () => {
- // eslint-disable-next-line global-require
- const enquire = require('enquire.js');
const wrapper = mount(
Cloud Database
@@ -51,14 +40,11 @@ describe('Descriptions', () => {
);
expect(wrapper.find('tr')).toHaveLength(5);
expect(wrapper.find('.ant-descriptions-item-no-label')).toHaveLength(1);
-
- enquire.callunmatch();
wrapper.unmount();
});
it('when max-width: 575px,column=2', () => {
// eslint-disable-next-line global-require
- const enquire = require('enquire.js');
const wrapper = mount(
Cloud Database
@@ -68,8 +54,6 @@ describe('Descriptions', () => {
,
);
expect(wrapper.find('tr')).toHaveLength(2);
-
- enquire.callunmatch();
wrapper.unmount();
});
diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx
index e16128e252..bbec5386f1 100644
--- a/components/drawer/index.tsx
+++ b/components/drawer/index.tsx
@@ -1,6 +1,5 @@
import * as React from 'react';
import RcDrawer from 'rc-drawer';
-import createReactContext from '@ant-design/create-react-context';
import { CloseOutlined } from '@ant-design/icons';
import classNames from 'classnames';
import omit from 'omit.js';
@@ -10,7 +9,7 @@ import { ConfigConsumerProps } from '../config-provider';
import { withConfigConsumer } from '../config-provider/context';
import { tuple } from '../_util/type';
-const DrawerContext = createReactContext(null);
+const DrawerContext = React.createContext(null);
type EventType =
| React.KeyboardEvent
diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap
index 19308f5926..fdfe0d494c 100644
--- a/components/form/__tests__/__snapshots__/demo.test.js.snap
+++ b/components/form/__tests__/__snapshots__/demo.test.js.snap
@@ -4038,7 +4038,48 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
>
+ >
+
+
+
+
+
+
+
+
+
+ Click to upload
+
+
+
+
@@ -318,7 +441,49 @@ exports[`renders ./components/upload/demo/directory.md correctly 1`] = `
>
+ >
+
+
+
+
+
+
+
+
+
+ Upload Directory
+
+
+
+