-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #837 from w3c/accessible-name-test-plan-report-sta…
…tus-dialog Fix aria-labeledby for BasicModal/BasicThemedModal
- Loading branch information
Showing
3 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |