Block library: fixes from the first visual test on the reference site

- CMSLink: a link that wraps content (a logo, a card) and leads nowhere keeps the
  content — an empty link group ({ type: 'internal' }) no longer hides logos
- entryList: field `collection` → `entryCollection` (Mongoose reserves
  `collection`; unreleased, snapshot updated) + a test against reserved names
- post template starts with a page hero holding the title (the page's h1)
- legal and cookie policy templates set noindex: true (AGENT.md §0c)
- hero background: a full bg-overlay scrim under the text
- MediaValue accepts any object (generated Media types fit without a cast)
- contact: Turnstile renders dark in an inverted section

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 15:03:39 +01:00
co-authored by Claude Opus 5.5
parent 51f80cea13
commit 29ede3ad4b
12 changed files with 85 additions and 30 deletions
+9 -1
View File
@@ -57,7 +57,7 @@ const header = { eyebrow: 'Eyebrow', heading: 'Section heading', intro: 'Intro t
const SAMPLES: Record<string, Record<string, unknown>> = {
contact: { content: null, form: { id: 'f1', confirmationType: 'message', fields: [{ name: 'name', blockType: 'text', label: 'Name', required: true }], submitButtonLabel: 'Send', title: 'Contact form' }, variant: 'formOnly' },
cta: { links, media: image(), variant: 'band' },
entryList: { collection: 'posts', limit: 3, links, mode: 'latest', variant: 'cards' },
entryList: { entryCollection: 'posts', limit: 3, links, mode: 'latest', variant: 'cards' },
faq: { items: [{ id: 'q1', answer: 'Yes, we do.', question: 'Do you ship?' }], links, variant: 'single' },
featureGrid: { columns: 'three', items: [{ id: 'i1', heading: 'Fast', link: { type: 'internal', page: { slug: 'fast' } }, media: image(), text: 'Quick delivery' }], links, variant: 'cards' },
gallery: { columns: 'three', items: [{ id: 'g1', caption: 'Kitchen', media: image('Kitchen') }, { id: 'g2', media: image('Hall') }], variant: 'grid' },
@@ -180,6 +180,14 @@ describe('block details', () => {
expect(await render(block('logos'))).toContain('alt="Acme"')
})
test('a link that wraps a logo but leads nowhere keeps the logo (an empty link group is stored as { type })', async () => {
const html = await render(block('logos', { items: [{ id: 'o1', heading: 'Acme', link: { type: 'internal' }, media: image('') }] }))
expect(html).toContain('alt="Acme"')
expect(html).not.toContain('<a')
const linked = await render(block('logos', { items: [{ id: 'o1', heading: 'Acme', link: { type: 'internal', page: { slug: 'acme' } }, media: image('') }] }))
expect(linked).toMatch(/<a[^>]*href="\/pl\/acme"[^>]*><img[^>]*alt="Acme"/)
})
test('testimonials: figure/blockquote/figcaption; the rating has a text equivalent per language', async () => {
const en = await render(block('testimonials'))
expect(en).toMatch(/<figure[^>]*>[\s\S]*<blockquote[^>]*>Great work\.<\/blockquote>[\s\S]*<figcaption/)