test(admin): unit and browser tests for the mail editor fields
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,7 +3,10 @@
|
||||
// appear in framework tests.
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { enableAutoUnmount, flushPromises, type VueWrapper } from '@vue/test-utils'
|
||||
import { isRef, type Ref } from 'vue'
|
||||
import { setBundle } from '../../src/app/i18n'
|
||||
import { FORM_LOCALE, FORM_VALUES } from '../../src/components/form/formContext'
|
||||
import SettingsFormView from '../../src/views/SettingsFormView.vue'
|
||||
import { setSettings } from '../../src/state/useSettings'
|
||||
import { clone, langFixture, settingsFixture } from '../fixtures/typed'
|
||||
import { API, mountApp, requestsTo, resetState, type Reply, type Route } from '../helpers'
|
||||
@@ -68,6 +71,22 @@ afterEach(() => {
|
||||
|
||||
enableAutoUnmount(afterEach)
|
||||
|
||||
describe('settings form context (Phase 35 mail branding)', () => {
|
||||
it('provides FORM_VALUES and FORM_LOCALE to nested fields', async () => {
|
||||
const { wrapper } = await openPage()
|
||||
const view = wrapper.findComponent(SettingsFormView)
|
||||
expect(view.exists()).toBe(true)
|
||||
const provides = (view.vm.$ as { provides?: Record<symbol | string, unknown> }).provides ?? {}
|
||||
const values = provides[FORM_VALUES as symbol] as Ref<Record<string, unknown>> | undefined
|
||||
const locale = provides[FORM_LOCALE as symbol] as Ref<string> | undefined
|
||||
expect(values && isRef(values)).toBe(true)
|
||||
expect(locale && isRef(locale)).toBe(true)
|
||||
expect(values!.value).toMatchObject({ use_engine: expect.anything() })
|
||||
expect(typeof locale!.value).toBe('string')
|
||||
expect(locale!.value.length).toBeGreaterThan(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('settings tabs (UI-SPEC F4)', () => {
|
||||
it('renders no tab strip for an untabbed schema', async () => {
|
||||
const { wrapper } = await openPage({ [`GET ${PAGE}/schema`]: { body: settingsFixture.schema } })
|
||||
|
||||
Reference in New Issue
Block a user