import type { LocaleMessages, Plural } from './locale'; /** Renders the component under test with the given props, waits for it to settle, and returns its host. */ export type DescribeLocalesRender = (props: Record, ancestorLang?: string) => Promise; /** Reads the rendered text for one message key off the host produced by `render`. */ export type DescribeLocalesRead = (host: Element, key: keyof M) => string | null | undefined; /** * One validity message a component reports through `ElementInternals.setValidity`, and how to * put the component in the state that reports it. */ export interface DescribeLocalesValidityCase { /** The message key the component passes to `setValidity` in that state. */ key: keyof M; /** The override prop that replaces the message, when it has one (`empty falls back` is generated from it). */ prop?: string; /** Renders the component in the state that reports `key` (e.g. `required` and empty), with the given props. */ render: DescribeLocalesRender; /** The `{name}` placeholder values (and `count`, for a `Plural`) the component fills into the message. */ vars?: Record; } /** The last `(flags, message)` a component handed to `internals.setValidity`, as recorded by `vitest-setup.ts`. */ export declare const lastValidity: (host: Element) => { flags: Partial | undefined; message: string | undefined; } | undefined; /** * A spec's `props` as host attributes: each key kebab-cased (`requiredMessage` → `required-message`, * the attribute every override prop has) and its value stringified. `undefined` entries are dropped. */ export declare const propsToAttrs: (props: Record) => Record; /** * Runs `run` with a `MutationObserver` stub in place (mock-doc has none, so `observeDocumentLang` * observes nothing otherwise) and hands it a `fire` that delivers a mutation to only the observer * `observeDocumentLang` itself creates — identified by ITS OWN `observe()` call, `document.documentElement` * with an `attributeFilter` naming `lang` — the `` listener path, without a real DOM. * Never every stub created meanwhile: a component using its own unrelated `MutationObserver` (e.g. * `nameHostWithFallback`'s `aria-label` watcher) would, in a real browser, never fire from a `lang` * mutation on a different target with a different `attributeFilter` — firing it anyway is a false * mutation the component never asked for, and a STATEFUL watcher (one that infers "did the CONSUMER * write this, or did I" from `takeRecords()`) misreads its own last write as a fresh consumer change. */ export declare const withLangObserver: (run: (fire: () => void) => Promise) => Promise; export interface DescribeLocalesOptions { render: DescribeLocalesRender; read: DescribeLocalesRead; /** Message key → the prop name `render`'s `props` accepts to override it with a plain string. */ overrides?: Partial>; /** * Message keys `read` cannot reach yet, each with the reason. `describeLocales` fails on any * table key absent from both the overrides sweep's reach and this list, rather than silently * skipping it. */ unreachable?: Partial>; /** * Plural message key → the prop name `render`'s `props` accepts a numeric `count` through, * for the "counts 1, 2, 5, 21" cases. Omitted for a table with no `Plural` keys. */ pluralCounts?: Partial>; /** * Message keys whose override prop is a visible optional caption (`scripts/eslint/override-classes.json`, * class `caption`): an empty override hides the text (`empty hides`) instead of falling back. */ captions?: Array; /** * Validity messages, for a component that calls `internals.setValidity`. Each case renders the * component in the state that reports its `key` and asserts that the message last handed to * `setValidity` follows the locale — through the `locale` prop and through the `` * observer — and that its override prop wins, an empty one falling back. A validity key is * covered by its case, so it needs neither `read` nor `unreachable`. */ validity?: DescribeLocalesValidityCase | Array>; } /** * Generates the shared locale contract's spec cases for one component: default `ro-MD`, * `locale="en-US"` carrying `lang="en-US"` on the host, an ancestor `lang="ru"`, an override * beating the locale, an empty override falling back to the dictionary (a caption's hiding the * text instead), an unsupported `locale` warning and falling back, a `locale` change after mount * re-rendering the copy, clearing `locale` again (the copy and the host's own `lang` both follow * the ancestors — a `lang` a consumer set directly on the host is overwritten while `locale` is * set and NOT restored once it clears, per decision A), a parent element's `lang` changing after * mount re-rendering the copy (`` observer), and — under `ru-MD` — the rendered shadow * DOM holding no `ro-MD`/`en-US` dictionary value. With the `validity` option, each validity * message also follows the locale through the `locale` prop and the `` observer. * Iterates every key of `table['ro-MD']`; a key neither reachable through `read`, nor a validity * case, nor listed in `unreachable` fails the run. */ export declare const describeLocales: (component: string, table: LocaleMessages, options: DescribeLocalesOptions) => void;