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:
co-authored by
Claude Opus 5.5
parent
51f80cea13
commit
29ede3ad4b
@@ -119,6 +119,17 @@ describe('faqItemsFromLayout', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('field names', () => {
|
||||
// Mongoose (MongoDB adapter — every live site) reserves these path names and warns on every start.
|
||||
const MONGOOSE_RESERVED = ['collection', 'db', 'emit', 'errors', 'get', 'init', 'isModified', 'isNew', 'listeners', 'modelName', 'on', 'once', 'populated', 'prototype', 'remove', 'removeListener', 'save', 'schema', 'set', 'toObject', 'validate']
|
||||
test('no block uses a name Mongoose reserves', () => {
|
||||
const offending = blockLibraryManifest.blocks.flatMap((b) =>
|
||||
b.fields.filter((f) => f.path.split(/\[\]\.|\./).some((seg) => MONGOOSE_RESERVED.includes(seg))).map((f) => `${b.slug}.${f.path}`),
|
||||
)
|
||||
expect(offending).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('blockLibraryManifest', () => {
|
||||
test('lists every block with its variants and fields, the primitives, builders and templates', () => {
|
||||
expect(blockLibraryManifest.blocks.map((b) => b.slug)).toEqual(LIBRARY_BLOCK_SLUGS)
|
||||
@@ -167,7 +178,7 @@ describe('page templates', () => {
|
||||
return
|
||||
}
|
||||
for (const [k, x] of Object.entries(o)) {
|
||||
if (['$form', '$page', 'appearance', 'blockType', 'collection', 'columns', 'limit', 'mode', 'show', 'type', 'variant'].includes(k)) {continue}
|
||||
if (['$form', '$page', 'appearance', 'blockType', 'columns', 'entryCollection', 'limit', 'mode', 'show', 'type', 'variant'].includes(k)) {continue}
|
||||
if (typeof x === 'string') {problems.push(`${where}.${k} = "${x}"`)}
|
||||
else {walk(x, `${where}.${k}`)}
|
||||
}
|
||||
@@ -176,6 +187,14 @@ describe('page templates', () => {
|
||||
expect(problems).toEqual([])
|
||||
})
|
||||
|
||||
test('post: the title is the page header (the only h1); legal pages are noindex', () => {
|
||||
const page = pageTemplates.post({ title: { en: 'Hello', pl: 'Cześć' } })
|
||||
expect(page.layout[0]).toMatchObject({ blockType: 'hero', header: { heading: { en: 'Hello', pl: 'Cześć' } }, variant: 'page' })
|
||||
expect(pageTemplates.legal('privacyPolicy').noindex).toBe(true)
|
||||
expect(pageTemplates.cookiePolicy().noindex).toBe(true)
|
||||
expect(pageTemplates.home().noindex).toBeUndefined()
|
||||
})
|
||||
|
||||
test('buttons link to pages by their slug in the default locale', () => {
|
||||
const json = JSON.stringify(pageTemplates.home())
|
||||
expect(json).toContain('{"$page":"kontakt"}')
|
||||
|
||||
Reference in New Issue
Block a user