@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
52 lines (51 loc) • 2.12 kB
TypeScript
import type { NodeDiff, Result } from "./html-comparer";
export type DomNode = {
classes: string[];
classSelector: string;
children: DomNode[];
};
export declare const ANSI: {
reset: string;
bold: string;
dim: string;
green: string;
red: string;
yellow: string;
cyan: string;
magenta: string;
gray: string;
orange: string;
};
export declare const NO_ANSI: typeof ANSI;
export declare function parseDom(node: Element, attributes: string[], parent?: string): void;
export declare function removeDuplicatedSpaces(text: string): string;
export declare function buildDomTree(element: Element): DomNode[];
export declare function sanitizeDomTreeNG(nodes: DomNode[]): DomNode[];
export declare function jaccardSimilarity(a: string[], b: string[]): number;
export declare function diffTrees(actual: DomNode[], expected: DomNode[], depth?: number): NodeDiff[];
export declare function markNodeSubtree(node: DomNode, status: 'extra' | 'missing', depth: number): NodeDiff;
/**
* Extract bare class names from allow-list entries (e.g. ".k-button" → "k-button").
*/
export declare function extractAllowedClasses(allowList: string[]): Set<string>;
type DiffLike = {
status: string;
matchedClasses: string[];
extraClasses: string[];
missingClasses: string[];
children: DiffLike[];
};
/**
* Post-process a tree diff to remove allowed classes from diffs.
* - 'different' nodes: filter allowed classes; upgrade to 'matched' if no diffs remain.
* - 'missing' nodes: if ALL classes are covered by allowMissing, mark subtree as matched.
* - 'extra' nodes: if ALL classes are covered by allowExtra, mark subtree as matched.
*/
export declare function applyAllowsToDiff<T extends DiffLike>(nodes: T[], allowMissingClasses: Set<string>, allowExtraClasses: Set<string>): void;
export declare function generateSuggestions(result: Result): {
allowMissing: string[];
allowExtra: string[];
};
export declare function renderDiffTree(nodes: NodeDiff[], c: typeof ANSI, indent?: string): string;
export declare function escHtml(text: string): string;
export {};