Adds the Instagram section to the homepage

Shows the handle as a link to the profile and six square photos from edge
to edge (2, 3 or 6 per row), each linking to the profile in a new tab.
The photos are ones the page already loads, so the section adds no
downloads; the API will later fill it with the real feed. Without a valid
https link to Instagram the section is left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 00:26:41 +02:00
co-authored by Claude Opus 5.5
parent f8905f5586
commit 52c1864a38
13 changed files with 511 additions and 36 deletions
+44
View File
@@ -13,6 +13,7 @@ import { FakeIntersectionObserver } from './test/fakeIntersectionObserver';
import { routeTree } from './routeTree.gen';
import sitePages from './sitePages';
import { axeResults } from './test/axe';
import type { SocialLink } from './content/types';
import system from './theme';
// Laat PageIntro op verzoek crashen, om de foutpagina binnen de shell te testen
@@ -30,6 +31,24 @@ vi.mock('./components/PageIntro/PageIntro', async (importOriginal) => {
};
});
// Lets a test replace the social links, e.g. without a valid Instagram link
const socials = vi.hoisted(() => ({
override: null as SocialLink[] | null,
}));
vi.mock('./content/siteContent', async (importOriginal) => {
const original = (
await importOriginal<typeof import('./content/siteContent')>()
).default;
return {
default: {
...original,
get socials() {
return socials.override ?? original.socials;
},
},
};
});
// The homepage's review carousel (Zag) needs an IntersectionObserver and
// Element.scrollTo, which jsdom lacks
beforeEach(() => {
@@ -39,6 +58,7 @@ beforeEach(() => {
afterEach(() => {
crash.enabled = false;
socials.override = null;
vi.unstubAllGlobals();
FakeIntersectionObserver.reset();
// @ts-expect-error -- jsdom has no Element.scrollTo of its own
@@ -148,6 +168,7 @@ describe('homepage', () => {
screen.getByRole('region', { name: 'Prijzen' }),
screen.getByRole('region', { name: 'Lieve woorden' }),
screen.getByRole('region', { name: 'Contact' }),
screen.getByRole('region', { name: 'Instagram' }),
];
let previous: Element = hero;
@@ -161,6 +182,29 @@ describe('homepage', () => {
expect(screen.getAllByRole('heading', { level: 1 })).toHaveLength(1);
expect(await axeResults(container)).toHaveNoViolations();
});
it.each([
['missing', []],
[
'not https',
[
{
platform: 'instagram',
href: 'http://www.instagram.com/andreaslopfotografie/',
},
],
],
] satisfies [string, SocialLink[]][])(
'leaves out the Instagram section when its link is %s',
async (_, links) => {
socials.override = links;
await renderApp('/');
await screen.findByRole('region', { name: 'Contact' });
expect(
screen.queryByRole('region', { name: 'Instagram' }),
).toBeNull();
},
);
});
describe('homepage ?pakket=', () => {