Skip to content

Commit

Permalink
LPS-144301 document-library-video Upgrade to testing library 12
Browse files Browse the repository at this point in the history
- 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 testing-library/dom-testing-library#937
  • Loading branch information
victorg1991 committed Jan 4, 2022
1 parent be2c91c commit 42bbccd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -33,8 +33,6 @@ const renderComponent = (props) =>
render(<DLVideoExternalShortcutDLFilePicker {...props} />);

describe('DLVideoExternalShortcutDLFilePicker', () => {
afterEach(cleanup);

describe('when rendered with the default props', () => {
let result;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -39,8 +39,6 @@ const renderComponent = (props) =>
render(<DLVideoExternalShortcutURLItemSelectorView {...props} />);

describe('DLVideoExternalShortcutURLItemSelectorView', () => {
afterEach(cleanup);

describe('when rendered with the default props', () => {
let result;

Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit 42bbccd

Please sign in to comment.