import React from 'react' import { render, screen } from '@testing-library/react' import { MenuHeading } from '../MenuHeading' import { MenuItem } from '../MenuItem' import { MenuList } from './MenuList' describe('MenuList', () => { describe('With a heading', () => { it('gives the list an accessible name of the section heading text', () => { render( A menu section}> , ) expect(screen.getByRole('list', { name: 'A menu section' })).toBeInTheDocument() }) it('applies custom heading props', () => { render( A menu section}> , ) expect(screen.getByRole('heading', { name: 'A menu section', level: 2 })).toBeInTheDocument() }) }) it('still links ids correctly when a heading id provided', () => { render( A menu section}> , ) expect(screen.getByRole('list', { name: 'A menu section' })).toBeInTheDocument() }) })