Block library: noSnippet option for sections repeated on every page

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 14:13:37 +01:00
co-authored by Claude Opus 5.5
parent 2a07fb8844
commit 6e6de5d0cc
4 changed files with 20 additions and 3 deletions
+6
View File
@@ -237,6 +237,12 @@ describe('block details', () => {
warn.mockRestore()
})
test('noSnippet keeps a repeated section out of search snippets', async () => {
const map = createBlockRegistry(content, { noSnippet: ['cta'] })
expect(await render(h(map.cta, { blockType: 'cta', header, locale: 'en', ...SAMPLES.cta }))).toMatch(/^<div><div data-nosnippet="">/)
expect(await render(block('cta'))).not.toContain('data-nosnippet')
})
test('classNames replace one part’s classes', async () => {
const map = createBlockRegistry(content, { classNames: { faq: { item: 'my-item' } } })
const html = await render(h(map.faq, { blockType: 'faq', locale: 'en', ...SAMPLES.faq }))