FramedImage and MediaText take a colour for the block behind the photo (sand by default) and MediaText can put the photo in the right-hand column from lg, without changing the reading order. RichParagraph moves to the shared components, a new CallToAction closes a page with a heading, lead and action, and the homepage pricing section gets the anchor #prijzen. A test helper reads the generated CSS rules, since jsdom applies neither media queries nor pseudo-elements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { screen } from '@testing-library/react';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { axeResults } from '@/test/axe';
|
|
import { renderWithProviders } from '@/test/renderWithProviders';
|
|
import RichParagraph from './RichParagraph';
|
|
|
|
describe('RichParagraph', () => {
|
|
it('renders text and links in reading order', async () => {
|
|
const { container } = await renderWithProviders(
|
|
<RichParagraph
|
|
paragraph={[
|
|
'Bekijk ',
|
|
{ text: 'mijn portfolio', to: '/portfolio' },
|
|
' of ',
|
|
{ text: 'neem contact op', to: '/', hash: 'contact' },
|
|
'!',
|
|
]}
|
|
/>,
|
|
);
|
|
expect(container).toHaveTextContent(
|
|
'Bekijk mijn portfolio of neem contact op!',
|
|
);
|
|
expect(
|
|
screen.getByRole('link', { name: 'mijn portfolio' }),
|
|
).toHaveAttribute('href', '/portfolio');
|
|
expect(
|
|
screen.getByRole('link', { name: 'neem contact op' }),
|
|
).toHaveAttribute('href', '/#contact');
|
|
expect(await axeResults(container)).toHaveNoViolations();
|
|
});
|
|
|
|
it('renders a paragraph without links as plain text', async () => {
|
|
await renderWithProviders(<RichParagraph paragraph={['Hoi!']} />);
|
|
expect(screen.getByText('Hoi!')).toBeInTheDocument();
|
|
expect(screen.queryByRole('link')).not.toBeInTheDocument();
|
|
});
|
|
});
|