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
+12
-7
@@ -91,13 +91,13 @@ block has them) → `variant` (sidebar) → `settings` (sidebar: anchor, backgro
|
||||
|
||||
| Slug (builder) | Panel name | Own fields | Variants | Accessibility |
|
||||
|---|---|---|---|---|
|
||||
| `hero` (`buildHeroBlock`) | Hero / `Sekcja główna` | `media` (image or video), `poster` | `split`, `background`, `centered`, `page` | the first section's heading is the page `h1`; its image is the LCP image (eager, high priority); a background image is decorative (`alt=""`) under a scrim |
|
||||
| `hero` (`buildHeroBlock`) | Hero / `Sekcja główna` | `media` (image or video), `poster` | `split`, `background`, `centered`, `page` | the first section's heading is the page `h1`; its image is the LCP image (eager, high priority); a background image is decorative (`alt=""`) under a full `bg-overlay` scrim (raise `--ipal-overlay` for very light photos) |
|
||||
| `textMedia` (`buildTextMediaBlock`) | Text and image | `content` (rich text), `media` | `mediaRight`, `mediaLeft` | reading order = text first on every screen |
|
||||
| `featureGrid` (`buildFeatureGridBlock`) | Feature grid | `items[]`: `icon` (with `icons`), `media`, `heading`, `text`, `link`; `columns` | `cards`, `list`, `numbered` | a linked feature: its heading is the link and covers the card; a dead link leaves plain text |
|
||||
| `gallery` (`buildGalleryBlock`) | Gallery | `items[]`: `media`, `caption`; `columns` | `grid`, `masonry` | each image a `LightboxTrigger` (keyboard, focus return, labels from Form messages); captions in `<figcaption>` |
|
||||
| `faq` (`buildFaqBlock`) | FAQ | `items[]`: `question`, `answer` | `single`, `twoColumn` | native `<details>`/`<summary>`, works without script |
|
||||
| `cta` (`buildCtaBlock`) | Call to action | `media` | `band`, `card`, `split` | renders nothing without a heading and buttons |
|
||||
| `contact` (`buildContactBlock`) | Contact | `form` (relation), `content` | `formWithDetails`, `formOnly` | `RenderForm` (labels, errors, consent); details as `<dl>` |
|
||||
| `contact` (`buildContactBlock`) | Contact | `form` (relation), `content` | `formWithDetails`, `formOnly` | `RenderForm` (labels, errors, consent); details as `<dl>`; the spam check widget turns dark in an inverted section |
|
||||
| `team` (`buildTeamBlock`) | Team | `items[]`: `media`, `heading` (name), `text` (role), `bio`, `link` | `grid`, `list` | the name is the profile link |
|
||||
| `pricing` (`buildPricingBlock`) | Pricing | `items[]`: `heading`, `price`, `period`, `text`, `features[]`, `highlighted`, `link`; `highlightLabel`, `note` | — | the highlighted plan carries a text label, not only a colour |
|
||||
| `logos` (`buildLogosBlock`) | Logos | `items[]`: `media`, `heading` (name), `link` | `row`, `grid` | the name is the alt text when the image has none; no marquee |
|
||||
@@ -105,7 +105,7 @@ block has them) → `variant` (sidebar) → `settings` (sidebar: anchor, backgro
|
||||
| `stats` (`buildStatsBlock`) | Key figures / `Liczby` | `items[]`: `value`, `heading` (label), `text` | `row`, `cards` | a `<dl>`; static (no count-up animation) |
|
||||
| `richText` (`buildRichTextBlock`) | Text | `content`, `tableOfContents` | `narrow`, `wide` | heading anchors + table of contents (`aria-current` on the section being read) |
|
||||
| `steps` (`buildStepsBlock`) | Steps | `items[]`: `heading`, `text`, `media` | `numbered`, `timeline` | an `<ol>`; the number read as "Step 1" |
|
||||
| `entryList` (`buildEntryListBlock`) | Entry list | `collection`, `mode` (latest / chosen), `limit`, `entries` | `cards`, `list` | each title links to its entry and covers the card; dates in `<time>` |
|
||||
| `entryList` (`buildEntryListBlock`) | Entry list | `entryCollection`, `mode` (latest / chosen), `limit`, `entries` | `cards`, `list` | each title links to its entry and covers the card; dates in `<time>` |
|
||||
|
||||
**Rules every block meets:** one `<section>` with `aria-labelledby` its heading and `data-ipal-block`; `h1` only in the
|
||||
first block (`isFirst` from `createPageRoute`), `h2` otherwise, items `h3`; images through `Media` (alt from the media
|
||||
@@ -140,6 +140,9 @@ the components come from `createBlockRegistry({ icons })`), `testimonials: { col
|
||||
collection as well), `entryList: { collections: [{ label: { en: 'Projects', pl: 'Realizacje' }, value: 'projects' }] }`
|
||||
(default posts), `contact: { formsCollection }` (default `forms`).
|
||||
|
||||
**Field names** never use a path name Mongoose reserves (`collection`, `schema`, `errors`, `get`, `set`…) — MongoDB is
|
||||
on every live site and warns on each start (a test enforces it for the library; keep to it in your own `fields`).
|
||||
|
||||
**Same panel for the project's own blocks:** `buildItemsField({ fields, labels, rowLabelField, maxRows })`,
|
||||
`buildMediaField()`, `buildVariantField({ options })`, `buildIconField({ names })`, `buildContentField()`,
|
||||
`columnsField()` (values `COLUMNS`: `two`, `three`, `four`), `adminText(en, pl)`, `variantOption(value, en, pl)`, and
|
||||
@@ -167,7 +170,9 @@ plugin's components. `content` needs `resolveLink`; `getEntries` (entry list), `
|
||||
|
||||
**UI primitives** (`/blocks/rsc`), each styled once with token utilities: `Section` (anchor, background,
|
||||
`data-surface` for the inverted token scope, spacing, `Container`), `SectionHeader` (eyebrow, `h1`/`h2`, intro),
|
||||
`Media` (image or video; `next/image` when passed), `CMSLink` (a panel link → `Anchor`, with `buttonClass`),
|
||||
`Media` (image or video; `next/image` when passed; `resource` takes any media object, so generated `Media` types fit),
|
||||
`CMSLink` (a panel link → `Anchor`, with `buttonClass`; a link that wraps something — a logo, a card — and leads nowhere
|
||||
keeps its content without a link, so an empty link group never hides it),
|
||||
`buttonClass` / `BUTTON_CLASSES` (button looks by appearance), `Container` / `CONTAINER_WIDTHS`, `Card` / `CARD_CLASS` /
|
||||
`CARD_INTERACTIVE_CLASS`. Helpers for the project's own blocks: `Buttons` (a block's button row), `headingId(block)`
|
||||
(the heading id for `aria-labelledby`), `TitleLink` (a card title that links when its link resolves), `GRID_COLUMNS`,
|
||||
@@ -212,9 +217,9 @@ overwrites an existing file (`--dest`, `--dry-run`).
|
||||
| `service({ form? })` | hero · textMedia · featureGrid (list) · gallery · faq · contact | — |
|
||||
| `contact({ form })` | hero (page) · contact · faq | — |
|
||||
| `blogIndex()` | hero (page) · cta — the entries come from the archive view (docs/content.md) | `postsArchive` |
|
||||
| `post()` | richText (table of contents) · entryList · cta — for a posts collection with a `layout` field | — |
|
||||
| `legal('privacyPolicy' \| 'termsOfService')` | hero (page) · richText (table of contents) — structure only; the wording comes from the client | `privacyPolicy`, `termsOfService` |
|
||||
| `cookiePolicy()` | hero (page) · richText | `cookiePolicy` |
|
||||
| `post({ title })` | hero (page, the post title as `h1`) · richText (table of contents) · entryList · cta — for a posts collection with a `layout` field | — |
|
||||
| `legal('privacyPolicy' \| 'termsOfService')` | hero (page) · richText (table of contents), `noindex: true` — structure only; the wording comes from the client | `privacyPolicy`, `termsOfService` |
|
||||
| `cookiePolicy()` | hero (page) · richText, `noindex: true` | `cookiePolicy` |
|
||||
| `notFound()` | hero (page) with a button home | `notFound` |
|
||||
|
||||
```ts
|
||||
|
||||
@@ -36,7 +36,15 @@ export async function ContactBlock(props: LibraryBlockProps<ContactBlockData>) {
|
||||
])
|
||||
const formEl = (
|
||||
<div className={c.form}>
|
||||
<RenderForm action={ctx.sendForm} classNames={ctx.formClassNames} form={form as never} linkOptions={linkOptions} locale={locale} texts={texts as BuilderFormTexts} />
|
||||
<RenderForm
|
||||
action={ctx.sendForm}
|
||||
classNames={ctx.formClassNames}
|
||||
form={form as never}
|
||||
linkOptions={linkOptions}
|
||||
locale={locale}
|
||||
texts={texts as BuilderFormTexts}
|
||||
turnstileTheme={settings?.background === 'inverted' ? 'dark' : 'page'}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
const aside = withDetails && (content || details.length) ? (
|
||||
|
||||
@@ -7,8 +7,8 @@ import { cx, parts } from '../../ui/cx.js'
|
||||
import { TitleLink } from '../../ui/TitleLink.js'
|
||||
|
||||
export type EntryListBlockData = {
|
||||
collection?: null | string
|
||||
entries?: { relationTo: string; value: unknown }[] | null
|
||||
entryCollection?: null | string
|
||||
limit?: null | number
|
||||
mode?: null | string
|
||||
} & BaseBlockData
|
||||
@@ -36,7 +36,7 @@ type Row = { card: EntryCard; collection: string; doc: Record<string, unknown> }
|
||||
|
||||
/** The latest entries of a collection, or entries chosen by hand; each card links to its entry. */
|
||||
export async function EntryListBlock(props: LibraryBlockProps<EntryListBlockData>) {
|
||||
const { classNames, collection, ctx, entries, header, isFirst, limit, links, locale, mode, settings, ui, variant } = props
|
||||
const { classNames, ctx, entries, entryCollection: collection, header, isFirst, limit, links, locale, mode, settings, ui, variant } = props
|
||||
const toCard = ctx.entryCard ?? defaultEntryCard
|
||||
let docs: { collection: string; doc: Record<string, unknown> }[] = []
|
||||
if (mode === 'selected') {
|
||||
|
||||
@@ -19,7 +19,8 @@ export const buildEntryListBlock = defineLibraryBlock<EntryListOptions>({
|
||||
const latest = (_: unknown, s: { mode?: string } | undefined) => s?.mode !== 'selected'
|
||||
return [
|
||||
{
|
||||
name: 'collection',
|
||||
// Not `collection`: Mongoose reserves that path name.
|
||||
name: 'entryCollection',
|
||||
type: 'select',
|
||||
defaultValue: collections[0]?.value,
|
||||
label: adminText('Show', 'Pokaż'),
|
||||
|
||||
@@ -10,7 +10,7 @@ export type HeroBlockData = { media?: MediaValue; poster?: MediaValue } & BaseBl
|
||||
export const HERO_PARTS = {
|
||||
background: 'relative isolate flex min-h-[var(--ipal-hero-min-h)] items-center overflow-hidden',
|
||||
backgroundMedia: 'absolute inset-0 -z-10 h-full w-full object-cover',
|
||||
backgroundOverlay: 'absolute inset-0 -z-10 bg-linear-to-t from-overlay to-transparent',
|
||||
backgroundOverlay: 'absolute inset-0 -z-10 bg-overlay',
|
||||
centered: 'mx-auto max-w-narrow text-center',
|
||||
media: 'h-auto w-full rounded-media object-cover',
|
||||
page: 'max-w-measure',
|
||||
|
||||
@@ -10,7 +10,7 @@ export type SectionHeaderData = { eyebrow?: null | string; heading?: null | stri
|
||||
export type SectionSettingsData = { [key: string]: unknown; anchor?: null | string; background?: null | string }
|
||||
|
||||
/** An upload as stored (an id) or populated (a media document). */
|
||||
export type MediaValue = null | number | Record<string, unknown> | string | undefined
|
||||
export type MediaValue = null | number | object | string | undefined
|
||||
|
||||
export type LinkData = LinkValue | null | undefined
|
||||
|
||||
|
||||
@@ -27,7 +27,13 @@ export type TemplateOptions = {
|
||||
}
|
||||
|
||||
/** A page for `seed.upsertBySlug('pages', [...])`. */
|
||||
export type TemplatePage = { layout: Record<string, unknown>[]; slug: TemplateValue; title: TemplateValue }
|
||||
export type TemplatePage = {
|
||||
layout: Record<string, unknown>[]
|
||||
/** Set on legal pages (AGENT.md §0c) — the `noindex` field of buildNoindexField; a collection without it ignores it. */
|
||||
noindex?: boolean
|
||||
slug: TemplateValue
|
||||
title: TemplateValue
|
||||
}
|
||||
|
||||
/** The templates' own page slugs, by page. */
|
||||
export const TEMPLATE_SLUGS = {
|
||||
|
||||
@@ -15,6 +15,9 @@ const cta = (options?: TemplateOptions) => ({
|
||||
variant: 'band',
|
||||
})
|
||||
|
||||
/** Legal pages stay out of search results (AGENT.md §0c); set `noindex: false` on the result to change it. */
|
||||
const noindex = (page: TemplatePage): TemplatePage => ({ ...page, noindex: true })
|
||||
|
||||
const items = (n: number, make: (i: number) => Record<string, unknown>) => Array.from({ length: n }, (_, i) => make(i + 1))
|
||||
|
||||
/** Home: hero, logos, features, text and image, key figures, testimonials, FAQ, call to action. */
|
||||
@@ -81,11 +84,13 @@ export function blogIndex(options?: TemplateOptions): TemplatePage {
|
||||
return buildTemplate('blogIndex', { slug: tx('blog', 'blog'), title: tx('Blog', 'Blog') }, [pageHero(tx('Blog', 'Blog'), fill('what the posts are about', 'o czym są wpisy')), cta(options)], options)
|
||||
}
|
||||
|
||||
/** Post body for a posts collection with a `layout` field: text with a table of contents, more posts, call to action. */
|
||||
/** Post body for a posts collection with a `layout` field: the title as the page header (h1), text with a table of contents, more posts, call to action. */
|
||||
export function post(options?: TemplateOptions): TemplatePage {
|
||||
return buildTemplate('post', { slug: fill('post-address', 'adres-wpisu'), title: fill('post title', 'tytuł wpisu') }, [
|
||||
const title = options?.title ?? fill('post title', 'tytuł wpisu')
|
||||
return buildTemplate('post', { slug: fill('post-address', 'adres-wpisu'), title }, [
|
||||
{ blockType: 'hero', header: header(title as Record<string, string>), variant: 'page' },
|
||||
{ blockType: 'richText', content: richText(fill('post text', 'treść wpisu')), tableOfContents: { label: tx('Contents', 'Spis treści'), show: true }, variant: 'narrow' },
|
||||
{ blockType: 'entryList', collection: 'posts', header: header(tx('Read also', 'Przeczytaj też')), limit: 3, mode: 'latest', variant: 'cards' },
|
||||
{ blockType: 'entryList', entryCollection: 'posts', header: header(tx('Read also', 'Przeczytaj też')), limit: 3, mode: 'latest', variant: 'cards' },
|
||||
cta(options),
|
||||
], options)
|
||||
}
|
||||
@@ -95,10 +100,10 @@ const LEGAL = {
|
||||
termsOfService: { slug: tx('terms', 'regulamin'), title: tx('Terms of service', 'Regulamin') },
|
||||
}
|
||||
|
||||
/** A legal page (privacy policy, terms): header and text with a table of contents. Structure only — the wording comes from the client. */
|
||||
/** A legal page (privacy policy, terms): header and text with a table of contents, `noindex`. Structure only — the wording comes from the client. */
|
||||
export function legal(role: keyof typeof LEGAL, options?: TemplateOptions): TemplatePage {
|
||||
const { slug, title } = LEGAL[role]
|
||||
return buildTemplate(role, { slug, title }, [
|
||||
return noindex(buildTemplate(role, { slug, title }, [
|
||||
pageHero(title),
|
||||
{
|
||||
blockType: 'richText',
|
||||
@@ -109,15 +114,15 @@ export function legal(role: keyof typeof LEGAL, options?: TemplateOptions): Temp
|
||||
tableOfContents: { label: tx('Contents', 'Spis treści'), show: true },
|
||||
variant: 'narrow',
|
||||
},
|
||||
], options)
|
||||
], options))
|
||||
}
|
||||
|
||||
/** Cookie policy: header and text; put the cookie table (CookieTable) on it in your page view or own block. */
|
||||
/** Cookie policy: header and text, `noindex`; put the cookie table (CookieTable) on it in your page view or own block. */
|
||||
export function cookiePolicy(options?: TemplateOptions): TemplatePage {
|
||||
return buildTemplate('cookiePolicy', { slug: tx('cookie-policy', 'polityka-cookies'), title: tx('Cookie policy', 'Polityka cookies') }, [
|
||||
return noindex(buildTemplate('cookiePolicy', { slug: tx('cookie-policy', 'polityka-cookies'), title: tx('Cookie policy', 'Polityka cookies') }, [
|
||||
pageHero(tx('Cookie policy', 'Polityka cookies')),
|
||||
{ blockType: 'richText', content: richText(fill('cookie policy text from the client', 'treść polityki cookies od klienta')), tableOfContents: { show: false }, variant: 'narrow' },
|
||||
], options)
|
||||
], options))
|
||||
}
|
||||
|
||||
/** 404: a small header with a button home. */
|
||||
|
||||
@@ -11,7 +11,7 @@ import { cx } from './cx.js'
|
||||
export type ResolveLink = (link: LinkData, locale: string) => null | Promise<null | ResolvedLink> | ResolvedLink
|
||||
|
||||
export type CMSLinkProps = {
|
||||
/** For a link that wraps something (a card, an image): the content instead of the label. */
|
||||
/** For a link that wraps something (a card, an image): the content instead of the label — shown without a link when the link leads nowhere. */
|
||||
children?: ReactNode
|
||||
className?: string
|
||||
link: LinkData
|
||||
@@ -28,9 +28,12 @@ export async function CMSLink({
|
||||
locale,
|
||||
resolve,
|
||||
}: { buttonClass?: (appearance?: null | string) => string; Link?: LinkComponent; resolve: ResolveLink } & CMSLinkProps) {
|
||||
const l = await resolve(link, locale)
|
||||
const content = children ?? l?.label
|
||||
if (!l || !content) {return null}
|
||||
const l = link ? await resolve(link, locale) : null
|
||||
// A link that wraps something (a logo, a card) and leads nowhere — an empty link group, a deleted page —
|
||||
// keeps its content as it is; a plain text link without a target renders nothing.
|
||||
if (!l) {return children ?? null}
|
||||
const content = children ?? l.label
|
||||
if (!content) {return null}
|
||||
const cls = cx(buttonClass(l.appearance), className) || undefined
|
||||
return (
|
||||
<Anchor className={cls} href={l.href} internal={l.internal} Link={Link} targetProps={l.targetProps}>
|
||||
|
||||
@@ -1300,7 +1300,7 @@
|
||||
"header.intro": {
|
||||
"type": "textarea"
|
||||
},
|
||||
"collection": {
|
||||
"entryCollection": {
|
||||
"type": "select",
|
||||
"required": true,
|
||||
"options": [
|
||||
|
||||
@@ -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"}')
|
||||
|
||||
@@ -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/)
|
||||
|
||||
Reference in New Issue
Block a user