Add initial project files
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import type { PageInput } from '#base_modules/WebManager/types/web_manager'
|
||||
|
||||
let sequence = 0
|
||||
|
||||
/**
|
||||
* A minimal valid page input; override per test.
|
||||
*
|
||||
* `hero` defaults to a minimal object rather than null: the HTTP validator
|
||||
* (`hero: jsonObjectSchema`) requires an object, so null only works when
|
||||
* calling WebManagerService directly.
|
||||
*/
|
||||
export function pageInput(overrides: Partial<PageInput> = {}): PageInput {
|
||||
sequence += 1
|
||||
|
||||
return {
|
||||
locale: 'en',
|
||||
path: `spec-page-${sequence}`,
|
||||
groupKey: `spec-page-${sequence}`,
|
||||
pageType: 'landing',
|
||||
title: 'Spec page',
|
||||
hero: { type: 'none', ctaItems: [] },
|
||||
seoTitle: '',
|
||||
seoDescription: '',
|
||||
components: [],
|
||||
...overrides,
|
||||
} as PageInput
|
||||
}
|
||||
|
||||
/** A minimal valid `content` component. */
|
||||
export function contentComponent(text = 'Hello') {
|
||||
return {
|
||||
type: 'content',
|
||||
data: {
|
||||
// Non-empty on purpose: the JSON bodyparser nulls empty strings, which the
|
||||
// strict block validator then rejects; only the multipart `payload` JSON
|
||||
// string transports '' intact. See the "empty strings survive" spec.
|
||||
title: 'Section',
|
||||
subtitle: 'Sub',
|
||||
columns: [{ content: { content: `<p>${text}</p>` }, ctaItems: [] }],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/** A minimal valid `banner` component. */
|
||||
export function bannerComponent(text = 'Banner') {
|
||||
return {
|
||||
type: 'banner',
|
||||
data: { style: 'info', content: { content: `<p>${text}</p>` }, ctaItems: [] },
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user