PatternFly 6 Testing Patterns¶
This directory contains comprehensive testing guides for PatternFly 6 components in JSDOM test environments (Vitest).
Testing Guides¶
- Modal Testing - Complete guide for testing PatternFly 6 Modal components
- Dropdown & Pagination Testing - Testing dropdowns, menus, and pagination components
- Context-Dependent Components - Testing components that require parent context (Alert, Modal, etc.)
- Switch Components - Testing PatternFly 6 Switch components
Common Testing Patterns¶
Key Principles¶
- Use PatternFly Testing Utilities - Leverage official testing helpers
- Mock Portal Rendering - Handle components that render to portals
- Test Accessibility - Verify ARIA attributes and keyboard navigation
- Handle Async Updates - Use
waitForand proper async testing patterns
Common Issues¶
- Portal Components: Modals, dropdowns, and tooltips render to
document.body - Context Requirements: Some components need parent context providers
- Async Rendering: PatternFly components may have delayed DOM updates
Testing Stack¶
- Vitest: Test runner
- React Testing Library: Component testing utilities
- @testing-library/user-event: User interaction simulation
- @patternfly/react-core: PatternFly 6 components
Related Documentation¶
- PatternFly Guidelines - Development principles
- Common Issues - Troubleshooting guide