Skip to content

Commit

Permalink
refactor(@clayui/modal): LPD-15613 Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ilzamcmed committed Jun 7, 2024
1 parent 55c372c commit 13806fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/clay-modal/src/__tests__/IncrementalInteractions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import ClayModal, {ClayModalProvider, Context, useModal} from '..';
import Button from '@clayui/button';
import {act, cleanup, fireEvent, render} from '@testing-library/react';
import {act, cleanup, fireEvent, render, waitFor} from '@testing-library/react';

Check failure on line 10 in packages/clay-modal/src/__tests__/IncrementalInteractions.tsx

View workflow job for this annotation

GitHub Actions / test

'waitFor' is defined but never used. Allowed unused vars must match /^_/u
import React from 'react';
import ReactDOM from 'react-dom';

Expand Down Expand Up @@ -166,7 +166,7 @@ describe('Modal -> IncrementalInteractions', () => {
expect(document.querySelector(modalElSelector)).toBeDefined();
});

it('close the modal when pressing ESC', () => {
it('close the modal when pressing ESC', async () => {
const {container} = render(<ModalWithState initialVisible />);

act(() => {
Expand All @@ -182,9 +182,9 @@ describe('Modal -> IncrementalInteractions', () => {
expect(backdropEl).toBeDefined();
expect(modalEl).toBeDefined();

fireEvent.keyUp(container, {key: 'Escape'});
fireEvent.keyDown(container, {key: 'Escape'});

expect(document.body.classList).not.toContain('modal-open');
expect(document.body.classList).not.toContain({"0": "modal-open"});

Check failure on line 187 in packages/clay-modal/src/__tests__/IncrementalInteractions.tsx

View workflow job for this annotation

GitHub Actions / test

Unnecessarily quoted property '0' found
expect(document.querySelector(backdropElSelector)).toBeNull();
expect(document.querySelector(modalElSelector)).toBeNull();
});
Expand Down

0 comments on commit 13806fc

Please sign in to comment.