import type { Assert } from './assert.js'; import type { SemanticDomOptions } from './types.js'; /** * DOM-specific assertion methods */ export declare class AssertDom { #private; constructor(assertInstance: Assert); /** * Asserts that an element contains the specified text content. * Traverses all child nodes to extract text content, trims whitespace, * and checks for substring inclusion. * * @example * ```ts * const btn = document.querySelector('button') * assert.dom.hasText(btn, 'Submit') * ``` * * @useWhen Validating that expected text appears anywhere inside an element's DOM tree, * regardless of inner nested tags. * * @param element The DOM element to check * @param text The text string expected to be contained * @param message - Optional message to display when the assertion fails */ hasText(element: Element, text: string, message?: string): void; /** * Asserts that an element has the specified class name. * * @example * ```ts * const alert = document.querySelector('.alert') * assert.dom.hasClass(alert, 'alert-danger') * ``` * * @useWhen Verifying state changes applied via CSS classes (e.g., active, disabled, error states). * * @param element The DOM element to check * @param className The expected class name * @param message - Optional message to display when the assertion fails */ hasClass(element: Element, className: string, message?: string): void; /** * Asserts that an element has a specific attribute. If the `value` argument * is provided, it will also assert that the attribute equals that value. * * @example * ```ts * const input = document.querySelector('input') * assert.dom.hasAttribute(input, 'required') * assert.dom.hasAttribute(input, 'type', 'email') * ``` * * @useWhen Validating ARIA roles, input types, custom data attributes, or disabled states. * * @param element The DOM element to check * @param name The attribute name * @param value Optional expected value of the attribute * @param message - Optional message to display when the assertion fails */ hasAttribute(element: Element, name: string, value?: string, message?: string): void; /** * Asserts that an element is visible in the DOM. * Visibility is determined by offsetParent (for layout visibility) or * having getBoundingClientRect dimensions. * Note: This does not account for opacity: 0 or visibility: hidden. * * @example * ```ts * const modal = document.querySelector('.modal') * assert.dom.isVisible(modal) * ``` * * @useWhen You need to verify that an element is actually rendered and taking up space * in the layout hierarchy (e.g., checking if a dropdown opened). * * @param element The DOM element to check * @param message - Optional message to display when the assertion fails */ isVisible(element: HTMLElement, message?: string): void; /** * Asserts that an element is currently focused (i.e. document.activeElement). * * @example * ```ts * const input = document.querySelector('#username') * input.focus() * assert.dom.isFocused(input) * ``` * * @useWhen Testing keyboard navigation, accessibility features, and autofocus behaviors. * * @param element The DOM element to check * @param message - Optional message to display when the assertion fails */ isFocused(element: Element, message?: string): void; /** * Asserts that an element has the specified tag name (case-insensitive). * * @example * ```ts * const link = document.querySelector('.custom-link') * assert.dom.hasTagName(link, 'a') * ``` * * @useWhen Verifying the semantic HTML structure (e.g., ensuring a component renders an `