chore(Drawer): Include OUIAProps for Drawer#12580
Conversation
Add OUIA attribute support to Drawer for better test automation. Co-authored-by: Cursor <cursoragent@cursor.com>
WalkthroughDrawer now supports OUIA props, renders OUIA data attributes on its root element, tests the behavior, and lists Drawer in the OUIA documentation. ChangesDrawer OUIA integration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/react-core/src/components/Drawer/Drawer.tsx (1)
71-71: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider adding a fallback string for the component type.
Since
Drawer.displayNameis typed asstring | undefinedonReact.FunctionComponent, passing it directly touseOUIAProps(which expects a strictstring) could cause a TypeScript error depending on project strictness settings. It could also result in an unwantedPF6/undefinedtype if the displayName property gets stripped during minification.Providing a static fallback string ensures a valid, stable
ouiaComponentTypeis always generated.♻️ Proposed refactor
- const ouiaProps = useOUIAProps(Drawer.displayName, ouiaId, ouiaSafe); + const ouiaProps = useOUIAProps(Drawer.displayName || 'Drawer', ouiaId, ouiaSafe);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react-core/src/components/Drawer/Drawer.tsx` at line 71, Update the useOUIAProps call in Drawer to pass a stable literal fallback when Drawer.displayName is undefined, ensuring the component type is always a strict, non-empty string and never generates PF6/undefined.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/react-core/src/components/Drawer/Drawer.tsx`:
- Line 71: Update the useOUIAProps call in Drawer to pass a stable literal
fallback when Drawer.displayName is undefined, ensuring the component type is
always a strict, non-empty string and never generates PF6/undefined.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 204f2c03-8c1e-4e34-830a-33b0c6dfd3ea
⛔ Files ignored due to path filters (1)
packages/react-core/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (3)
packages/react-core/src/components/Drawer/Drawer.tsxpackages/react-core/src/components/Drawer/__tests__/Drawer.test.tsxpackages/react-core/src/helpers/OUIA/OUIA.md
rebeccaalpert
left a comment
There was a problem hiding this comment.
Ouia stuff looks good, but tests are failing. Would you mind taking a look?
Add OUIA attribute support to Drawer for better test automation.
What: Closes #12579
Summary by CodeRabbit
New Features
Tests