Adds the Soorten fotoshoots page
Replaces the placeholder with the five shoot types (Newborn, Zwangerschap, Gezin, Loveshoot, Portretten), each an article with its own anchor, photo, text and a link to the contact form that preselects the matching package. A portfolio link per shoot shows once the portfolio page is live. A closing call to action links to the prices and the contact form. The page is indexed with its own description and preview image, and describes the shoots as services of the business in structured data. That data is rendered in the page component, so the shoot texts stay out of the main bundle. The shoot photos are cropped at 848x1060, no longer upscaled. Photo pages get a mobile Lighthouse performance target of 0.85: their largest paint is a photo that the simulated slow connection only requests after the scripts have run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import { screen, within } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import packages from '@/content/packages';
|
||||
import shootTypes from '@/content/shootTypes';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import ShootBlock from './ShootBlock';
|
||||
|
||||
const shoot = (id: string) => shootTypes.find((item) => item.id === id)!;
|
||||
|
||||
const renderBlock = (
|
||||
id: string,
|
||||
{ portfolioLive = false, reverse = false, priority = false } = {},
|
||||
) =>
|
||||
renderWithProviders(
|
||||
<ShootBlock
|
||||
shoot={shoot(id)}
|
||||
packages={packages}
|
||||
reverse={reverse}
|
||||
priority={priority}
|
||||
portfolioLive={portfolioLive}
|
||||
/>,
|
||||
);
|
||||
|
||||
describe('ShootBlock', () => {
|
||||
it('is an article named by its heading, with the anchor id', async () => {
|
||||
const { container } = await renderBlock('newborn');
|
||||
const article = screen.getByRole('article', { name: 'Newborn' });
|
||||
expect(article).toHaveAttribute('id', 'newborn');
|
||||
expect(
|
||||
within(article).getByRole('heading', { level: 2 }),
|
||||
).toHaveTextContent('Newborn');
|
||||
expect(within(article).getByRole('img')).toHaveAccessibleName(
|
||||
shoot('newborn').image.alt,
|
||||
);
|
||||
expect(
|
||||
within(article).getByText(/De fotoshoot vindt bij jou thuis/),
|
||||
).toBeInTheDocument();
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('links to the contact form with the package preselected', async () => {
|
||||
await renderBlock('zwangerschap');
|
||||
const link = screen.getByRole('link', {
|
||||
name: 'Stuur een berichtje over een zwangerschapsshoot',
|
||||
});
|
||||
expect(link).toHaveAttribute('href', '/?pakket=zwangerschap#contact');
|
||||
});
|
||||
|
||||
it('links to the contact form without a package when the shoot has none', async () => {
|
||||
await renderBlock('loveshoot');
|
||||
expect(
|
||||
screen.getByRole('link', {
|
||||
name: 'Stuur een berichtje over een loveshoot',
|
||||
}),
|
||||
).toHaveAttribute('href', '/#contact');
|
||||
});
|
||||
|
||||
it('only links to the portfolio once it is live', async () => {
|
||||
await renderBlock('portret');
|
||||
expect(screen.queryByTestId('shoot-portret-portfolio')).toBeNull();
|
||||
});
|
||||
|
||||
it('links to the portfolio filtered on the shoot type when live', async () => {
|
||||
await renderBlock('portret', { portfolioLive: true });
|
||||
expect(
|
||||
screen.getByRole('link', { name: "Bekijk meer portretfoto's" }),
|
||||
).toHaveAttribute('href', '/portfolio?shoot=portret');
|
||||
});
|
||||
|
||||
it('loads a priority photo straight away and others lazily', async () => {
|
||||
await renderBlock('newborn', { priority: true });
|
||||
expect(screen.getByRole('img')).not.toHaveAttribute('loading', 'lazy');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user