test: element tests for E8 types and currency, E9 states and queue, E10 list caps, the parent select

- E8: the page and profile type options, an invalid currency
- E9: the checking line with aria-busy, noRules per type, one queued
  request, the danger line and its recovery
- E10: both lists capped at 10
- the parent select's value parsing, empty default and disabled state
This commit is contained in:
Jakub Zych
2026-11-04 19:54:06 +01:00
parent 82b0dacff9
commit 075cf17007
4 changed files with 193 additions and 0 deletions

View File

@@ -89,6 +89,26 @@ describe('E8 golem15-seo-schema', () => {
expect(node.querySelector('.seo-schema__status')!.textContent).toBe(labelsFor('en').jsonTooLarge)
})
it('renders the page type options and a fixed ProfilePage for profiles', () => {
const page = mountSchema('page', '')
const en = labelsFor('en')
expect([...page.querySelectorAll('option')].map((o) => o.textContent)).toEqual(['Default (WebPage)', en.tWebPage, en.tAboutPage, en.tContactPage, en.tService])
document.body.replaceChildren()
const profile = mountSchema('profile', '')
expect(profile.querySelector('select')).toBeNull()
expect(profile.querySelector('.seo-schema__fixed')!.textContent).toBe(en.tProfilePage)
})
it('flags an invalid currency and keeps the Service fields out of a non-Service value', () => {
const node = mountSchema('page', JSON.stringify({ type: 'Service', fields: { currency: 'PLN' }, custom: '' }))
const currency = node.querySelectorAll<HTMLInputElement>('.seo-schema__grid input')[3]
currency.value = 'ZLOTY'
currency.dispatchEvent(new Event('input'))
expect(node.textContent).toContain(labelsFor('en').currencyInvalid)
expect(JSON.parse(node.value).fields.currency).toBe('PLN')
expect(serializeValue(parseValue(JSON.stringify({ type: 'AboutPage', fields: {}, custom: '' })))).toBe(JSON.stringify({ type: 'AboutPage', fields: {}, custom: '' }))
})
it('shows a single fixed type for collections', () => {
const node = mountSchema('collection', '')
expect(node.querySelector('select')).toBeNull()