UNPKG

@birhaus/test-utils

Version:

BIRHAUS Testing & Validation Framework - Comprehensive testing utilities for cognitive load, accessibility, and BIRHAUS principle compliance

1 lines 31.1 kB
{"version":3,"sources":["../../src/undo/UndoPatternValidator.ts"],"names":[],"mappings":";;;;AAkEO,IAAM,uBAAN,MAA2B;AAAA,EAiChC,WAAA,CAAY,OAAA,GAA2B,EAAC,EAAG;AA7B3C;AAAA,IAAA,IAAA,CAAiB,oBAAA,GAAuB;AAAA,MACtC,mBAAA;AAAA,MACA,mBAAA;AAAA,MACA,UAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA,sBAAA;AAAA,MACA,2BAAA;AAAA,MACA;AAAA,KACF;AAGA;AAAA,IAAA,IAAA,CAAiB,mBAAA,GAAsB;AAAA,MACrC,SAAA;AAAA,MACA,WAAA;AAAA,MACA,SAAA;AAAA,MACA,SAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAA;AAAA,MACA,cAAA;AAAA,MACA,QAAA;AAAA,MACA;AAAA,KACF;AAGE,IAAA,IAAA,CAAK,OAAA,GAAU;AAAA,MACb,yBAAA,EAA2B,IAAA;AAAA,MAC3B,oBAAA,EAAsB,IAAA;AAAA,MACtB,mBAAA,EAAqB,IAAA;AAAA,MACrB,qBAAA,EAAuB,IAAA;AAAA,MACvB,kBAAA,EAAoB,GAAA;AAAA;AAAA,MACpB,cAAA,EAAgB,GAAA;AAAA;AAAA,MAChB,cAAA,EAAgB,GAAA;AAAA;AAAA,MAChB,oBAAA,EAAsB;AAAA,QACpB,wBAAA;AAAA,QACA,wBAAA;AAAA,QACA,gBAAA;AAAA,QACA,gBAAA;AAAA,QACA,yBAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA,gBAAA,EAAkB;AAAA,QAChB,QAAA;AAAA,QACA,UAAA;AAAA,QACA,QAAA;AAAA,QACA,QAA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AAA,KAC1D;AAAA,EACF;AACF","file":"index.mjs","sourcesContent":["/**\n * BIRHAUS Undo Pattern Validator\n * \n * Testing utilities for BIRHAUS Principle #5: \"Undo over confirm\"\n * \n * Features:\n * - Confirmation dialog detection (anti-pattern)\n * - Undo functionality validation\n * - Undo timeout testing\n * - Destructive action pattern verification\n * - Spanish-first undo messaging\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n// Undo testing requires flexible event handling types\n\nimport { waitFor } from '@testing-library/react'\n// import { screen, within, fireEvent } from '@testing-library/react' // Available for future test extensions\nimport userEvent from '@testing-library/user-event'\n\nexport interface UndoPatternViolation {\n type: 'confirmation-dialog' | 'missing-undo' | 'invalid-timeout' | 'poor-undo-ux' | 'missing-spanish'\n element: Element\n severity: 'minor' | 'moderate' | 'serious' | 'critical'\n message: string\n messageEs: string\n actionType?: 'delete' | 'destructive' | 'irreversible'\n birhausPrinciple: number\n suggestions: string[]\n}\n\nexport interface UndoTestOptions {\n // Pattern detection\n detectConfirmationDialogs?: boolean\n validateUndoPresence?: boolean\n validateUndoTimeout?: boolean\n validateUndoMessaging?: boolean\n \n // Timeout settings\n defaultUndoTimeout?: number\n maxUndoTimeout?: number\n minUndoTimeout?: number\n \n // Destructive actions\n destructiveSelectors?: string[]\n destructiveTexts?: string[]\n \n // Spanish requirements\n requireSpanishUndoMessages?: boolean\n \n // Selectors\n confirmationSelectors?: string[]\n undoSelectors?: string[]\n destructiveActionSelectors?: string[]\n}\n\nexport interface UndoTestResult {\n undoAvailable: boolean\n undoTimeout: number\n undoMessage: string\n undoMessageSpanish: boolean\n undoTriggered: boolean\n originalState: any\n undoState: any\n}\n\nexport class UndoPatternValidator {\n private options: Required<UndoTestOptions>\n \n // Confirmation dialog anti-patterns\n private readonly confirmationPatterns = [\n /are\\s+you\\s+sure/i,\n /¿está.?\\s+seguro/i,\n /confirm/i,\n /confirmar/i,\n /delete.*\\?/i,\n /eliminar.*\\?/i,\n /really.*delete/i,\n /realmente.*eliminar/i,\n /this.*cannot.*be.*undone/i,\n /esto.*no.*se.*puede.*deshacer/i\n ]\n \n // Destructive action patterns\n private readonly destructivePatterns = [\n /delete/i,\n /eliminar/i,\n /remove/i,\n /quitar/i,\n /destroy/i,\n /destruir/i,\n /clear/i,\n /limpiar/i,\n /reset/i,\n /restablecer/i,\n /purge/i,\n /purgar/i\n ]\n \n constructor(options: UndoTestOptions = {}) {\n this.options = {\n detectConfirmationDialogs: true,\n validateUndoPresence: true,\n validateUndoTimeout: true,\n validateUndoMessaging: true,\n defaultUndoTimeout: 10000, // 10 seconds\n maxUndoTimeout: 30000, // 30 seconds max\n minUndoTimeout: 3000, // 3 seconds min\n destructiveSelectors: [\n '[data-action=\"delete\"]',\n '[data-action=\"remove\"]',\n '.delete-button',\n '.remove-button',\n 'button[class*=\"delete\"]',\n 'button[class*=\"remove\"]'\n ],\n destructiveTexts: [\n 'delete',\n 'eliminar',\n 'remove',\n 'quitar',\n 'destroy',\n 'destruir'\n ],\n requireSpanishUndoMessages: true,\n confirmationSelectors: [\n '[role=\"alertdialog\"]',\n '[role=\"dialog\"]',\n '.confirmation-dialog',\n '.confirm-modal',\n '.alert-dialog'\n ],\n undoSelectors: [\n '[data-action=\"undo\"]',\n '.undo-button',\n 'button[class*=\"undo\"]',\n '[aria-label*=\"undo\"]',\n '[aria-label*=\"deshacer\"]'\n ],\n destructiveActionSelectors: [\n 'button[data-destructive=\"true\"]',\n '.destructive-action',\n '[data-birhaus-component=\"button\"][variant=\"destructive\"]'\n ],\n ...options\n }\n }\n \n /**\n * Validate all undo pattern compliance\n */\n async validateAll(container: HTMLElement = document.body): Promise<UndoPatternViolation[]> {\n const violations: UndoPatternViolation[] = []\n \n if (this.options.detectConfirmationDialogs) {\n violations.push(...this.detectConfirmationDialogs(container))\n }\n \n if (this.options.validateUndoPresence) {\n violations.push(...this.validateUndoPresence(container))\n }\n \n if (this.options.validateUndoMessaging) {\n violations.push(...this.validateUndoMessaging(container))\n }\n \n return violations\n }\n \n /**\n * Detect confirmation dialogs (anti-pattern)\n */\n // eslint-disable-next-line max-lines-per-function -- Dialog detection requires comprehensive pattern matching\n detectConfirmationDialogs(container: HTMLElement): UndoPatternViolation[] {\n const violations: UndoPatternViolation[] = []\n \n // Check for confirmation dialogs\n this.options.confirmationSelectors.forEach(selector => {\n const dialogs = container.querySelectorAll(selector)\n \n dialogs.forEach(dialog => {\n const text = dialog.textContent || ''\n const hasConfirmationPattern = this.confirmationPatterns.some(pattern => \n pattern.test(text)\n )\n \n if (hasConfirmationPattern) {\n violations.push({\n type: 'confirmation-dialog',\n element: dialog,\n severity: 'critical',\n message: 'Confirmation dialog detected - violates BIRHAUS Principle #5',\n messageEs: 'Diálogo de confirmación detectado - viola el Principio BIRHAUS #5',\n actionType: 'destructive',\n birhausPrinciple: 5,\n suggestions: [\n 'Replace confirmation with undo functionality',\n 'Use BirhausDialog with undo pattern',\n 'Implement immediate action with undo option',\n 'Show success message with undo button'\n ]\n })\n }\n })\n })\n \n // Check for window.confirm() usage in onclick handlers\n const elementsWithOnclick = container.querySelectorAll('[onclick]')\n elementsWithOnclick.forEach(element => {\n const onclick = element.getAttribute('onclick') || ''\n if (onclick.includes('confirm(')) {\n violations.push({\n type: 'confirmation-dialog',\n element: element,\n severity: 'critical',\n message: 'JavaScript confirm() detected in onclick handler',\n messageEs: 'confirm() de JavaScript detectado en manejador onclick',\n birhausPrinciple: 5,\n suggestions: [\n 'Remove confirm() call from onclick',\n 'Implement undo pattern instead',\n 'Use BirhausButton with undo integration',\n 'Add data-destructive attribute for proper handling'\n ]\n })\n }\n })\n \n return violations\n }\n \n /**\n * Validate undo functionality is present for destructive actions\n */\n validateUndoPresence(container: HTMLElement): UndoPatternViolation[] {\n const violations: UndoPatternViolation[] = []\n \n // Find destructive actions\n const destructiveActions = this.findDestructiveActions(container)\n \n destructiveActions.forEach(action => {\n const hasUndoSupport = this.checkUndoSupport(action)\n \n if (!hasUndoSupport) {\n const actionText = action.textContent?.trim() || ''\n const actionType = this.getActionType(actionText)\n \n violations.push({\n type: 'missing-undo',\n element: action,\n severity: actionType === 'delete' ? 'serious' : 'moderate',\n message: `Destructive action \"${actionText}\" lacks undo functionality`,\n messageEs: `Acción destructiva \"${actionText}\" carece de funcionalidad de deshacer`,\n actionType,\n birhausPrinciple: 5,\n suggestions: [\n 'Add undo functionality to destructive action',\n 'Use BirhausButton with destructive variant and undo',\n 'Implement undo timeout with visual countdown',\n 'Show success message with undo option'\n ]\n })\n }\n })\n \n return violations\n }\n \n /**\n * Validate undo messaging and timeout settings\n */\n // eslint-disable-next-line max-lines-per-function -- Undo messaging validation requires comprehensive checking\n validateUndoMessaging(container: HTMLElement): UndoPatternViolation[] {\n const violations: UndoPatternViolation[] = []\n \n // Find undo buttons and messages\n const undoElements = container.querySelectorAll(\n this.options.undoSelectors.join(', ')\n )\n \n undoElements.forEach(undoElement => {\n // Check for timeout information\n const hasTimeout = this.hasTimeoutInfo(undoElement)\n if (!hasTimeout) {\n violations.push({\n type: 'poor-undo-ux',\n element: undoElement,\n severity: 'moderate',\n message: 'Undo element lacks timeout information',\n messageEs: 'Elemento de deshacer carece de información de tiempo límite',\n birhausPrinciple: 5,\n suggestions: [\n 'Add countdown timer to undo message',\n 'Show remaining time for undo action',\n 'Use BirhausDialog undo pattern with visual timer',\n 'Display auto-close information'\n ]\n })\n }\n \n // Check for Spanish messaging\n if (this.options.requireSpanishUndoMessages) {\n const hasSpanishMessage = this.hasSpanishUndoMessage(undoElement)\n if (!hasSpanishMessage) {\n violations.push({\n type: 'missing-spanish',\n element: undoElement,\n severity: 'moderate',\n message: 'Undo element lacks Spanish messaging',\n messageEs: 'Elemento de deshacer carece de mensajes en español',\n birhausPrinciple: 7,\n suggestions: [\n 'Add Spanish undo labels',\n 'Use \"Deshacer\" instead of \"Undo\"',\n 'Include Spanish timeout messages',\n 'Add labelEs prop to undo components'\n ]\n })\n }\n }\n })\n \n return violations\n }\n \n /**\n * Test undo functionality for a specific action\n */\n // eslint-disable-next-line max-lines-per-function -- Undo functionality testing requires comprehensive state management\n async testUndoFunctionality(\n actionElement: Element,\n container: HTMLElement = document.body\n ): Promise<UndoTestResult> {\n const user = userEvent.setup()\n \n // Capture initial state\n const initialState = this.captureState(container)\n \n // Trigger the action\n await user.click(actionElement as HTMLElement)\n \n // Wait for undo UI to appear\n let undoButton: HTMLElement | null = null\n let undoTimeout = 0\n let undoMessage = ''\n let undoMessageSpanish = false\n \n try {\n // Look for undo button with timeout\n await waitFor(() => {\n undoButton = container.querySelector(\n this.options.undoSelectors.join(', ')\n ) as HTMLElement\n \n if (!undoButton) {\n throw new Error('Undo button not found')\n }\n }, { timeout: 5000 })\n \n if (undoButton) {\n // Extract timeout information\n undoTimeout = this.extractUndoTimeout(undoButton)\n undoMessage = (undoButton as HTMLElement)?.textContent?.trim() || ''\n undoMessageSpanish = this.isSpanishUndoMessage(undoMessage)\n \n // Test undo action\n // const _stateBeforeUndo = this.captureState(container) // Reserved for state comparison tests\n await user.click(undoButton)\n \n // Wait for undo to complete\n await waitFor(() => {\n const currentState = this.captureState(container)\n return this.statesEqual(currentState, initialState)\n }, { timeout: 3000 })\n \n const finalState = this.captureState(container)\n \n return {\n undoAvailable: true,\n undoTimeout,\n undoMessage,\n undoMessageSpanish,\n undoTriggered: true,\n originalState: initialState,\n undoState: finalState\n }\n }\n } catch (error) {\n // Undo not available or failed\n }\n \n return {\n undoAvailable: false,\n undoTimeout: 0,\n undoMessage: '',\n undoMessageSpanish: false,\n undoTriggered: false,\n originalState: initialState,\n undoState: this.captureState(container)\n }\n }\n \n // Helper methods\n \n private findDestructiveActions(container: HTMLElement): Element[] {\n const actions: Element[] = []\n \n // Find by selectors\n this.options.destructiveSelectors.forEach(selector => {\n actions.push(...Array.from(container.querySelectorAll(selector)))\n })\n \n // Find by destructive text patterns\n const buttons = container.querySelectorAll('button, [role=\"button\"], a')\n buttons.forEach(button => {\n const text = button.textContent?.toLowerCase() || ''\n const isDestructive = this.destructivePatterns.some(pattern => \n pattern.test(text)\n )\n \n if (isDestructive) {\n actions.push(button)\n }\n })\n \n // Remove duplicates\n return Array.from(new Set(actions))\n }\n \n private checkUndoSupport(action: Element): boolean {\n // Check for BIRHAUS undo attributes\n if (action.hasAttribute('data-undo-support')) {\n return true\n }\n \n // Check for BirhausButton with undo variant\n if (action.getAttribute('data-birhaus-component') === 'button') {\n const undoConfig = action.getAttribute('data-undo-config')\n return !!undoConfig\n }\n \n // Check for parent container with undo functionality\n const parent = action.closest('[data-undo-container]')\n return !!parent\n }\n \n private getActionType(actionText: string): UndoPatternViolation['actionType'] {\n const lowerText = actionText.toLowerCase()\n \n if (/delete|eliminar|destroy|destruir/.test(lowerText)) {\n return 'delete'\n }\n \n if (/remove|quitar|clear|limpiar|reset|restablecer/.test(lowerText)) {\n return 'destructive'\n }\n \n return 'irreversible'\n }\n \n private hasTimeoutInfo(element: Element): boolean {\n const text = element.textContent || ''\n const ariaLabel = element.getAttribute('aria-label') || ''\n const title = element.getAttribute('title') || ''\n \n const allText = `${text} ${ariaLabel} ${title}`.toLowerCase()\n \n // Look for timeout indicators\n const timeoutPatterns = [\n /\\d+\\s*(seconds?|segundos?)/i,\n /auto.*close/i,\n /cierre.*automático/i,\n /remaining|restante/i,\n /countdown|cuenta.*regresiva/i\n ]\n \n return timeoutPatterns.some(pattern => pattern.test(allText))\n }\n \n private hasSpanishUndoMessage(element: Element): boolean {\n const text = element.textContent || ''\n const ariaLabel = element.getAttribute('aria-label') || ''\n \n const spanishUndoPatterns = [\n /deshacer/i,\n /revertir/i,\n /cancelar.*acción/i,\n /volver.*atrás/i\n ]\n \n return spanishUndoPatterns.some(pattern => \n pattern.test(text) || pattern.test(ariaLabel)\n )\n }\n \n public extractUndoTimeout(element: Element): number {\n // Try to extract timeout from various sources\n const timeoutAttr = element.getAttribute('data-undo-timeout')\n if (timeoutAttr) {\n return parseInt(timeoutAttr)\n }\n \n // Look for countdown in text\n const text = element.textContent || ''\n const match = text.match(/(\\d+)\\s*s/)\n if (match) {\n return parseInt(match[1]) * 1000\n }\n \n return this.options.defaultUndoTimeout\n }\n \n private isSpanishUndoMessage(message: string): boolean {\n const spanishPatterns = [\n /deshacer/i,\n /acción.*completada/i,\n /se.*deshizo/i,\n /revertido/i\n ]\n \n return spanishPatterns.some(pattern => pattern.test(message))\n }\n \n private captureState(container: HTMLElement): any {\n // Capture relevant state for comparison\n return {\n innerHTML: container.innerHTML,\n childElementCount: container.childElementCount,\n textContent: container.textContent,\n timestamp: Date.now()\n }\n }\n \n private statesEqual(state1: any, state2: any): boolean {\n // Simple state comparison - in real implementation, this would be more sophisticated\n return state1.childElementCount === state2.childElementCount &&\n state1.textContent === state2.textContent\n }\n}\n\n/**\n * Test helper functions for undo pattern assertions\n */\n\n/**\n * Assert no confirmation dialogs are present\n */\nexport function expectNoConfirmationDialogs(\n container?: HTMLElement\n): void {\n const validator = new UndoPatternValidator({ detectConfirmationDialogs: true })\n const violations = validator.detectConfirmationDialogs(container || document.body)\n \n if (violations.length > 0) {\n const errorMessages = violations\n .map(v => v.message)\n .join('\\n')\n \n throw new Error(\n `Confirmation dialog anti-patterns detected:\\n${errorMessages}\\n\\n` +\n 'Use undo patterns instead of confirmation dialogs.'\n )\n }\n}\n\n/**\n * Assert destructive actions have undo functionality\n */\nexport function expectUndoForDestructiveActions(\n container?: HTMLElement\n): void {\n const validator = new UndoPatternValidator({ validateUndoPresence: true })\n const violations = validator.validateUndoPresence(container || document.body)\n \n if (violations.length > 0) {\n const errorMessages = violations\n .map(v => v.message)\n .join('\\n')\n \n throw new Error(\n `Missing undo functionality detected:\\n${errorMessages}\\n\\n` +\n 'All destructive actions must have undo functionality.'\n )\n }\n}\n\n/**\n * Test undo functionality for a specific action\n */\nexport async function expectUndoWorks(\n actionElement: Element,\n container?: HTMLElement\n): Promise<void> {\n const validator = new UndoPatternValidator()\n const result = await validator.testUndoFunctionality(\n actionElement, \n container || document.body\n )\n \n if (!result.undoAvailable) {\n throw new Error('Undo functionality not available for destructive action')\n }\n \n if (!result.undoTriggered) {\n throw new Error('Undo action failed to restore original state')\n }\n \n if (!result.undoMessageSpanish) {\n console.warn('Undo message not in Spanish - consider adding Spanish labels')\n }\n}\n\n/**\n * Assert undo timeout is reasonable\n */\nexport function expectReasonableUndoTimeout(\n undoElement: Element,\n minMs: number = 3000,\n maxMs: number = 30000\n): void {\n const validator = new UndoPatternValidator()\n const timeout = validator.extractUndoTimeout(undoElement)\n \n if (timeout < minMs) {\n throw new Error(\n `Undo timeout ${timeout}ms is too short (minimum: ${minMs}ms)`\n )\n }\n \n if (timeout > maxMs) {\n throw new Error(\n `Undo timeout ${timeout}ms is too long (maximum: ${maxMs}ms)`\n )\n }\n}\n\n"]}