/** * A minimal in-memory DOM that satisfies the renderer's structural * {@link ElementLike} / {@link DocumentLike} types, for unit tests only. * * It is NOT part of the published build (excluded in `tsconfig.build.json`); it * lets the DOM renderer and the boot layer be exercised on Node with no DOM * library and no `as` cast — the fake is *structurally* the same subset the * browser's real `Document`/`Element` provide. */ import type { DocumentLike, ElementLike } from "./render.ts"; export declare class FakeElement implements ElementLike { #private; className: string; textContent: string | null; readonly tagName: string; readonly attributes: Map; readonly children: FakeElement[]; constructor(tagName: string); setAttribute(name: string, value: string): void; getAttribute(name: string): string | undefined; appendChild(child: ElementLike): ElementLike; replaceChildren(): void; addEventListener(type: string, handler: () => void): void; /** Fire every listener registered for `type` (test driver for clicks). */ dispatch(type: string): void; /** Depth-first walk of this element and its descendants. */ walk(): IterableIterator; /** Every descendant (and self) whose className contains `cls`. */ byClass(cls: string): FakeElement[]; /** Every descendant (and self) with `data-` equal to `value` (any value if omitted). */ byData(key: string, value?: string): FakeElement[]; /** The concatenated text content of this subtree (own text then children). */ text(): string; } export declare class FakeDocument implements DocumentLike { createElement(tagName: string): ElementLike; }