Files
react-test/packages/mui-material/test/integration/DialogIntegration.test.js

32 lines
961 B
JavaScript
Raw Normal View History

2025-12-12 14:26:25 +09:00
import * as React from 'react';
import { expect } from 'chai';
import { createRenderer, screen } from '@mui/internal-test-utils';
import Dialog from '@mui/material/Dialog';
import DialogTitle from '@mui/material/DialogTitle';
describe('<Dialog /> integration', () => {
const { render } = createRenderer();
it('is automatically labelled by its DialogTitle', () => {
render(
<Dialog open>
<DialogTitle>Set backup account</DialogTitle>
</Dialog>,
);
expect(screen.getByRole('dialog')).toHaveAccessibleName('Set backup account');
});
it('can be manually labelled', () => {
render(
<Dialog open aria-labelledby="dialog-title">
<DialogTitle id="dialog-title">Set backup account</DialogTitle>
</Dialog>,
);
const dialog = screen.getByRole('dialog');
expect(dialog).toHaveAccessibleName('Set backup account');
expect(dialog).to.have.attr('aria-labelledby', 'dialog-title');
});
});