import { ContextMap } from '../context/context-map'; interface Registration { key: string; host: HTMLElement; getter: () => unknown; handle: { teardown: () => void; notify: () => void; }; } interface Subscription { key: string; host: HTMLElement | undefined; listener: (value: unknown) => void; } /** * A minimal in-memory {@link ContextRegistry} double for tests. * * Tracks providers and subscriptions in plain arrays accessible via * `getRegistrations()` and `getSubscriptions()` so specs can assert * what the decorator under test registered. Other methods on the * registry interface are no-ops since the specs don't exercise them. */ export declare class TestContextRegistry { private registrations; private subscriptions; register(): void; list(): never[]; get(): void; provide(key: string, host: HTMLElement, getter: () => unknown): { teardown: () => void; notify: () => void; }; subscribe(key: string, host: HTMLElement | undefined, listener: (value: unknown) => void): () => void; getRegistrations(): Registration[]; getSubscriptions(): Subscription[]; } /** * Assert that a single `context-request` event was captured and that it * bubbles, is composed, and targets the given context key. Returns the * captured event so callers can assert further detail fields. * * @param events - Events captured by a `context-request` listener. * @param context - The context key the event is expected to target. * @returns The single captured event. */ export declare function expectBubblingComposedContextRequest(events: CustomEvent[], context: string): CustomEvent; /** * Register and return a plain `HTMLElement` subclass under the given * tag. Idempotent: a second call with the same tag returns the * constructor registered by the first call instead of redefining it. * * @param tag - The custom element tag to register under. * @returns The constructor registered for `tag`. */ export declare function definePlainHost(tag: string): CustomElementConstructor; /** * Component shape accepted by {@link attachHost}. Spec fixtures pass in * plain instances whose `host` slot the helper writes to and whose * `context` slot the bridging {@link LimeWebComponentElement} reads. */ interface AttachableComponent { host?: HTMLElement; context?: unknown; } /** * Attach a {@link LimeWebComponentElement} to `component` as its host * and answer ambient `'platform'` requests with a platform double built * from the given service map. * * Equivalent to what every spec's fixture does manually: create a host, * assign it to `component.host` so the centralized `getElement` mock * returns it, and wire up the context-request listener that answers * for `'platform'`. * * @param component - The component instance to attach a host to. * @param services - Service map keyed by name; entries are returned by * the platform double's `get(name)`. * @param host - Optional host element to attach; if omitted, a new * `LimeWebComponentElement` is created and used. * @returns The created host element. */ export declare function attachHost(component: AttachableComponent, services: Record, host?: HTMLElement): HTMLElement; /** * Install a self-backed get/set accessor for `key` on `target`. Reads * and writes route through a single backing variable closed over by the * accessor. Used to model both host props via the property bridge and * instance-only fields such as a `@State` member. * * @param target - the object to define the accessor on. * @param key - the property key to back with storage. */ export declare function installAccessor(target: object, key: string): void; /** * Options accepted by {@link createContextDecoratorFixture}. */ interface ContextDecoratorFixtureOptions { /** The decorator factory to apply, e.g. `ProvideContext` or `SelectContext`. */ decorator: (key: K) => PropertyDecorator; /** Keys to decorate; one property per key is added. */ keys: readonly K[]; /** Registry the host's platform double exposes. */ registry: TestContextRegistry; /** Lifecycle methods to install on the component prototype before decoration. */ methods?: Record unknown>; /** Initial values seeded on the component after construction. */ initialValues?: Partial>; } /** * Component shape returned by {@link createContextDecoratorFixture}. * Indexable so specs can read and write decorated properties without * casting, with lifecycle hooks typed as optional. */ export type FixtureComponent = AttachableComponent & { connectedCallback?: () => unknown | Promise; disconnectedCallback?: () => unknown | Promise; [key: string]: unknown; }; /** * Build a component class, apply a context decorator to a set of keys, * instantiate it, and wire its host up against the given * {@link TestContextRegistry}. Optionally seeds property values and * overrides lifecycle methods. * * Covers the common fixture shape used by `@SelectContext` and * `@ProvideContext` specs. * * @param options - See {@link ContextDecoratorFixtureOptions}. * @returns The instantiated component, with `host` attached. */ export declare function createContextDecoratorFixture(options: ContextDecoratorFixtureOptions): FixtureComponent; export {};