Project-defined link styles, legal links from System Pages; audit catches content-keyed logic, Polish text in code, link fields in globals
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -76,3 +76,31 @@ describe('section fields', () => {
|
||||
expect(buildSectionSettingsField({ backgrounds: false }).fields.map((f) => ('name' in f ? f.name : ''))).toEqual(['anchor'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('project-defined link styles', () => {
|
||||
test('appearances accept the project\'s own names and panel labels', async () => {
|
||||
const { buildLinkField } = await import('../src/modules/links/buildLinkField.js')
|
||||
const field = buildLinkField({ appearances: ['primary', { label: 'Highlighted', value: 'highlight' }] })
|
||||
const select = field.fields.find((f) => 'name' in f && f.name === 'appearance') as { defaultValue: string; options: unknown[] }
|
||||
expect(select.options).toEqual([{ label: 'primary', value: 'primary' }, { label: 'Highlighted', value: 'highlight' }])
|
||||
expect(select.defaultValue).toBe('primary')
|
||||
expect(resolveLink({ ...page('oferta'), appearance: 'highlight' }, opts)?.appearance).toBe('highlight')
|
||||
})
|
||||
})
|
||||
|
||||
describe('resolveSystemLinks', () => {
|
||||
test('href and label (page title) from System Pages; unassigned roles skipped', async () => {
|
||||
const { resolveSystemLinks } = await import('../src/modules/links/resolveNav.js')
|
||||
const settings = {
|
||||
cookiePolicy: null,
|
||||
privacyPolicy: { slug: 'polityka-prywatnosci', title: 'Polityka prywatności' },
|
||||
termsOfService: { slug: 'regulamin', title: 'Regulamin' },
|
||||
}
|
||||
expect(resolveSystemLinks(settings, opts).map((l) => [l.role, l.href, l.label])).toEqual([
|
||||
['privacyPolicy', '/pl/polityka-prywatnosci', 'Polityka prywatności'],
|
||||
['termsOfService', '/pl/regulamin', 'Regulamin'],
|
||||
])
|
||||
expect(resolveSystemLinks(settings, { ...opts, roles: ['termsOfService'] })).toHaveLength(1)
|
||||
expect(resolveSystemLinks(null, opts)).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user