From 630c24aa7939ac4d05d8820cb224cce955412465 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Fri, 14 Oct 2022 20:01:50 +0800 Subject: [PATCH] test: raise test covarage (#38027) * test: raise test covarage * chore: code clean * chore: lock jest-dom to v28 * chore: lock jest-dom * test: update setup --- components/modal/__tests__/confirm.test.tsx | 2 ++ package.json | 2 +- tests/setup.js | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/modal/__tests__/confirm.test.tsx b/components/modal/__tests__/confirm.test.tsx index 49c6fe2217..e696b9fe1d 100644 --- a/components/modal/__tests__/confirm.test.tsx +++ b/components/modal/__tests__/confirm.test.tsx @@ -283,6 +283,8 @@ describe('Modal.confirm triggers callbacks correctly', () => { jest.useFakeTimers(); const onCancel = jest.fn(); Modal.confirm({ + // test legacy visible + visible: true, title: 'title', content: 'content', onCancel, diff --git a/package.json b/package.json index 195f9c1bcd..cab91fc07c 100644 --- a/package.json +++ b/package.json @@ -187,7 +187,7 @@ "@types/warning": "^3.0.0", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.0.0", - "antd-img-crop": "^4.0.0", + "antd-img-crop": "4.2.5", "array-move": "^4.0.0", "babel-plugin-add-react-displayname": "^0.0.5", "bisheng": "^3.7.0-alpha.4", diff --git a/tests/setup.js b/tests/setup.js index f230185718..afd91cdbfe 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -15,6 +15,8 @@ if (typeof window !== 'undefined') { // ref: https://github.com/ant-design/ant-design/issues/18774 if (!window.matchMedia) { Object.defineProperty(global.window, 'matchMedia', { + writable: true, + configurable: true, value: jest.fn(query => ({ matches: query.includes('max-width'), addListener: jest.fn(),