feat(quick-261016-nqk): admin heads form and preview with meta.title (G-18.1-4)

This commit is contained in:
Jakub Zych
2026-10-16 17:19:54 +02:00
parent bc5685eb93
commit 013890c3d6
4 changed files with 37 additions and 6 deletions

View File

@@ -623,6 +623,14 @@ describe('password and preset on the form (UI-SPEC S7, D-19, D-27 G7)', () => {
expect(editor(wrapper, 'slug').element.value).toBe('ada-lovelace')
})
it("titles a record by the controller's meta.title when it sends one, and publishes it as the crumb", async () => {
const record = clone(rosterRecordFixture)
;(record.meta as { title?: string }).title = 'Person #1 (Ada)'
const { wrapper } = await mountApp('/acme/roster/people/1', people({ [`GET ${PERSON}`]: { body: record } }))
expect(wrapper.find('h1').text()).toBe('Person #1 (Ada)')
expect(recordCrumb.value).toBe('Person #1 (Ada)')
})
it('titles a record by the default locale of an mltext first field, and publishes it as the crumb', async () => {
const record = clone(rosterRecordFixture)
record.data.name = { en: 'Ada Lovelace', pl: 'Ada Lovelace PL' }

View File

@@ -139,6 +139,19 @@ describe('preview view (UI-SPEC S3, D-11)', () => {
expect(recordCrumb.value).toBe('Ada Lovelace')
})
it("heads the record by the controller's meta.title when it sends one, before the first text field", async () => {
const { wrapper } = await mountApp(
PREVIEW,
routes({
[`GET ${RECORD}`]: recordWith((record) => {
;(record.meta as { title?: string }).title = 'Person #1 (Ada)'
}),
}),
)
expect(wrapper.find('h1').text()).toBe('Person #1 (Ada)')
expect(recordCrumb.value).toBe('Person #1 (Ada)')
})
it('shows the muted dash for an empty value and the label of a relation, never its id', async () => {
const { wrapper } = await mountApp(PREVIEW, routes({ [`GET ${RECORD}`]: recordWith((record) => (record.data.joined_ip = null)) }))
expect(wrapper.find('[data-preview-field="joined_ip"] [data-empty]').text()).toBe('—')