From a10a8f7a8951539034ff510f7e5e631cd69bc296 Mon Sep 17 00:00:00 2001 From: Victor Galan Date: Tue, 21 Dec 2021 11:08:05 +0100 Subject: [PATCH] LPS-144301 document-library-video Upgrade to testing library 12 - cleanup is done automatically after each test - only forms with an accessible name have the role "form" Check: https://www.w3.org/TR/html-aria/#docconformance and https://github.com/testing-library/dom-testing-library/issues/937 --- .../test/DLVideoExternalShortcutDLFilePicker.js | 4 +--- .../test/DLVideoExternalShortcutURLItemSelectorView.js | 8 +++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/apps/document-library/document-library-video/test/DLVideoExternalShortcutDLFilePicker.js b/modules/apps/document-library/document-library-video/test/DLVideoExternalShortcutDLFilePicker.js index 268e7e5e142502..8cad6221861bd4 100644 --- a/modules/apps/document-library/document-library-video/test/DLVideoExternalShortcutDLFilePicker.js +++ b/modules/apps/document-library/document-library-video/test/DLVideoExternalShortcutDLFilePicker.js @@ -13,7 +13,7 @@ */ import {waitForElementToBeRemoved} from '@testing-library/dom'; -import {cleanup, fireEvent, render} from '@testing-library/react'; +import {fireEvent, render} from '@testing-library/react'; import React from 'react'; import '@testing-library/jest-dom/extend-expect'; @@ -33,8 +33,6 @@ const renderComponent = (props) => render(); describe('DLVideoExternalShortcutDLFilePicker', () => { - afterEach(cleanup); - describe('when rendered with the default props', () => { let result; diff --git a/modules/apps/document-library/document-library-video/test/DLVideoExternalShortcutURLItemSelectorView.js b/modules/apps/document-library/document-library-video/test/DLVideoExternalShortcutURLItemSelectorView.js index 6e3580b686533e..3b8d3717786641 100644 --- a/modules/apps/document-library/document-library-video/test/DLVideoExternalShortcutURLItemSelectorView.js +++ b/modules/apps/document-library/document-library-video/test/DLVideoExternalShortcutURLItemSelectorView.js @@ -13,7 +13,7 @@ */ import {waitForElementToBeRemoved} from '@testing-library/dom'; -import {cleanup, fireEvent, render} from '@testing-library/react'; +import {fireEvent, render} from '@testing-library/react'; import React from 'react'; import '@testing-library/jest-dom/extend-expect'; @@ -39,8 +39,6 @@ const renderComponent = (props) => render(); describe('DLVideoExternalShortcutURLItemSelectorView', () => { - afterEach(cleanup); - describe('when rendered with the default props', () => { let result; @@ -104,7 +102,7 @@ describe('DLVideoExternalShortcutURLItemSelectorView', () => { describe('when the form is submitted', () => { beforeEach(async () => { - fireEvent.submit(result.getByRole('form')); + fireEvent.submit(result.container.querySelector('form')); }); it('fires an event in the opener', () => { @@ -165,7 +163,7 @@ describe('DLVideoExternalShortcutURLItemSelectorView', () => { describe('when the form is submitted', () => { beforeEach(async () => { - fireEvent.submit(result.getByRole('form')); + fireEvent.submit(result.container.querySelector('form')); }); it('does not fire an event in the opener', () => {