From 99b022ef9388ac8150512218325e5d4d9b97e1c3 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Mon, 5 Oct 2020 11:53:54 +0200 Subject: [PATCH] Remove unused polyfills --- package.json | 1 - test/karma.tests.js | 3 --- test/utils/createClientRender.js | 35 ++------------------------------ yarn.lock | 5 ----- 4 files changed, 2 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index 4bca621606ad01..4e6f5fba0ea213 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,6 @@ "eslint-plugin-react-hooks": "^4.0.7", "expect-puppeteer": "^4.3.0", "format-util": "^1.0.5", - "formdata-polyfill": "^3.0.20", "fs-extra": "^9.0.0", "glob": "^7.1.2", "glob-gitignore": "^1.0.11", diff --git a/test/karma.tests.js b/test/karma.tests.js index da44018040f65b..554e82aa9ea4cb 100644 --- a/test/karma.tests.js +++ b/test/karma.tests.js @@ -1,6 +1,3 @@ -// https://github.com/airbnb/enzyme/issues/1792 -import 'core-js/modules/es6.array.from'; -import 'formdata-polyfill'; import './utils/init'; const integrationContext = require.context( diff --git a/test/utils/createClientRender.js b/test/utils/createClientRender.js index db68328d7b7a4e..4ed86bf51d149e 100644 --- a/test/utils/createClientRender.js +++ b/test/utils/createClientRender.js @@ -5,7 +5,6 @@ import { act, buildQueries, cleanup, - createEvent, fireEvent as rtlFireEvent, queries, render as testingLibraryRender, @@ -158,9 +157,6 @@ export function createClientRender(globalOptions = {}) { } const fireEvent = Object.assign(rtlFireEvent, { - // polyfill event.key(Code) for chrome 49 and edge 15 (supported in Material-UI v4) - // for user-interactions react does the polyfilling but manually created - // events don't have this luxury keyDown(element, options = {}) { // `element` shouldn't be `document` but we catch this later anyway const document = element.ownerDocument || element; @@ -182,21 +178,7 @@ const fireEvent = Object.assign(rtlFireEvent, { throw error; } - const event = createEvent.keyDown(element, options); - Object.defineProperty(event, 'key', { - get() { - return options.key || ''; - }, - }); - if (options.keyCode !== undefined && event.keyCode === 0) { - Object.defineProperty(event, 'keyCode', { - get() { - return options.keyCode; - }, - }); - } - - rtlFireEvent(element, event); + rtlFireEvent.keyDown(element, options); }, keyUp(element, options = {}) { // `element` shouldn't be `document` but we catch this later anyway @@ -218,21 +200,8 @@ const fireEvent = Object.assign(rtlFireEvent, { .join('\n'); throw error; } - const event = createEvent.keyUp(element, options); - Object.defineProperty(event, 'key', { - get() { - return options.key || ''; - }, - }); - if (options.keyCode !== undefined && event.keyCode === 0) { - Object.defineProperty(event, 'keyCode', { - get() { - return options.keyCode; - }, - }); - } - rtlFireEvent(element, event); + rtlFireEvent.keyUp(element, options); }, }); diff --git a/yarn.lock b/yarn.lock index 67708856686abc..6ee91796d86bfb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7831,11 +7831,6 @@ format-util@^1.0.5: resolved "https://registry.yarnpkg.com/format-util/-/format-util-1.0.5.tgz#1ffb450c8a03e7bccffe40643180918cc297d271" integrity sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg== -formdata-polyfill@^3.0.20: - version "3.0.20" - resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-3.0.20.tgz#d6319db8efc5cf4bb2da27856c2b902be63be1c6" - integrity sha512-TAaxIEwTBdoH1TWndtUH1T0/GisUHwmOKcV5hjkR/iTatHBJSOHb563FP86Lra5nXo3iNdhK7HPwMl5Ihg71pg== - forwarded@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"