Skip to content

Commit

Permalink
Unit test for aria-labeledby on BasicModal
Browse files Browse the repository at this point in the history
  • Loading branch information
stalgiag committed Nov 9, 2023
1 parent c1e7f0f commit 50cd6c8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions client/tests/BasicModal.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @jest-environment jsdom
*/

import React from 'react';
import { render } from '@testing-library/react';
import BasicModal from '../components/common/BasicModal/';
import '@testing-library/jest-dom/extend-expect';

describe('<BasicModal />', () => {
it('has aria-labelledby matching the modal title id', () => {
const { getByRole, getByText } = render(
<BasicModal show title="Test Title" content="Test Content" />
);

const modal = getByRole('dialog');
const title = getByText('Test Title');

expect(modal).toHaveAttribute('aria-labelledby', title.id);
});
});

0 comments on commit 50cd6c8

Please sign in to comment.