Adds the Contact page
The contact page in the approved layout: the form next to a photo with the contact card on wide screens, and the card with a small portrait above the form on phones, where the large photo is never downloaded. /contact?pakket= preselects a package. The page is indexed, with its own title, description, preview image and ContactPage structured data. Over mij and Soorten fotoshoots now link to /contact. The green button gets a darker background, so its white text meets the contrast minimum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+73
-8
@@ -144,10 +144,10 @@ describe('app', () => {
|
||||
).toHaveAttribute('href', '/portfolio');
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'neem contact op' }),
|
||||
).toHaveAttribute('href', '/#contact');
|
||||
).toHaveAttribute('href', '/contact');
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'Boek je shoot' }),
|
||||
).toHaveAttribute('href', '/#contact');
|
||||
).toHaveAttribute('href', '/contact');
|
||||
expect(
|
||||
screen.getByRole('list', { name: "Foto's" }),
|
||||
).toBeInTheDocument();
|
||||
@@ -163,6 +163,71 @@ describe('app', () => {
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('shows the contact page with its outline, cards and structured data', async () => {
|
||||
const { container } = await renderApp('/contact');
|
||||
await screen.findByRole('heading', { level: 1, name: 'Contact' });
|
||||
const main = within(screen.getByRole('main'));
|
||||
// Both cards are in the page; jsdom has no screen width, so the
|
||||
// headings are listed regardless of which layout is visible
|
||||
expect(
|
||||
main
|
||||
.getAllByRole('heading', { hidden: true })
|
||||
.map((h) => `${h.tagName} ${h.textContent}`),
|
||||
).toEqual([
|
||||
'H1 Contact',
|
||||
'H2 Direct contact',
|
||||
'H2 Stuur me een bericht',
|
||||
'H2 Direct contact',
|
||||
]);
|
||||
expect(
|
||||
screen.getByText(/ik reageer binnen 1-2 werkdagen\./),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole('region', { name: 'Stuur me een bericht' }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTestId('contact-details-narrow'),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByTestId('contact-details-wide')).toBeInTheDocument();
|
||||
expect(
|
||||
await screen.findByTestId('contact-form-shoot', undefined, {
|
||||
timeout: 10_000,
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
|
||||
expect(document.title).toBe(
|
||||
'Contact – fotoshoot boeken in Huizen | Andrea Slop Fotografie',
|
||||
);
|
||||
expect(document.head.querySelector('meta[name="robots"]')).toBeNull();
|
||||
const types = [
|
||||
...document.querySelectorAll('script[type="application/ld+json"]'),
|
||||
].map((script) => JSON.parse(script.textContent!)['@type']);
|
||||
expect(types.sort()).toEqual(['ContactPage', 'ProfessionalService']);
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('takes over ?pakket= on the contact page and tidies the URL without moving focus', async () => {
|
||||
const { router } = await renderApp('/contact?pakket=newborn');
|
||||
expect(
|
||||
await screen.findByTestId('contact-form-shoot', undefined, {
|
||||
timeout: 10_000,
|
||||
}),
|
||||
).toHaveValue('newborn');
|
||||
await waitFor(() => expect(router.state.location.searchStr).toBe(''));
|
||||
expect(router.state.location.pathname).toBe('/contact');
|
||||
expect(document.activeElement).toBe(document.body);
|
||||
});
|
||||
|
||||
it('drops an unknown ?pakket= on the contact page', async () => {
|
||||
const { router } = await renderApp('/contact?pakket=bruiloft');
|
||||
expect(
|
||||
await screen.findByTestId('contact-form-shoot', undefined, {
|
||||
timeout: 10_000,
|
||||
}),
|
||||
).toHaveValue('');
|
||||
await waitFor(() => expect(router.state.location.searchStr).toBe(''));
|
||||
});
|
||||
|
||||
it('shows the shoot types page with its outline, links and structured data', async () => {
|
||||
const { container } = await renderApp('/soorten-fotoshoots');
|
||||
await screen.findByRole('heading', {
|
||||
@@ -193,11 +258,11 @@ describe('app', () => {
|
||||
.getAllByRole('link', { name: /^Stuur een berichtje/ })
|
||||
.map((link) => link.getAttribute('href')),
|
||||
).toEqual([
|
||||
'/?pakket=newborn#contact',
|
||||
'/?pakket=zwangerschap#contact',
|
||||
'/?pakket=gezin#contact',
|
||||
'/#contact',
|
||||
'/#contact',
|
||||
'/contact?pakket=newborn',
|
||||
'/contact?pakket=zwangerschap',
|
||||
'/contact?pakket=gezin',
|
||||
'/contact',
|
||||
'/contact',
|
||||
]);
|
||||
// Links to the filtered portfolio only once that page is live
|
||||
// (indexed); they switch on by themselves when it is
|
||||
@@ -221,7 +286,7 @@ describe('app', () => {
|
||||
).toHaveAttribute('href', '/#prijzen');
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'Boek je shoot' }),
|
||||
).toHaveAttribute('href', '/#contact');
|
||||
).toHaveAttribute('href', '/contact');
|
||||
|
||||
expect(document.title).toBe(
|
||||
'Soorten fotoshoots | Andrea Slop Fotografie',
|
||||
|
||||
Reference in New Issue
Block a user