-
Notifications
You must be signed in to change notification settings - Fork 117
test(vue): add component tests for event handling #2241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a comprehensive testing setup for Vue components using Vitest and Playwright, which is a great step towards ensuring component reliability. It also includes a valuable accessibility fix for the ix-radio component, making it directly clickable and providing an accessible name. The refactoring of the application-breakpoints example to use @valueChange on the IxRadioGroup is a nice improvement for code clarity. I've added one comment regarding a potential accessibility improvement for the ix-radio component's label.
|



Testing Infrastructure Added + Radio Component Accessibility Fix
🧪 Testing Added
Why: No automated tests existed to validate event handling or prevent regressions.
What: Added Vitest testing infrastructure with Playwright browser mode:
packages/vue/- Unit tests for wrapper libraryplugin.spec.ts- validates plugin initialization & event naming (camelCase preservation)packages/vue-test-app/- Component integration testssetup.ts) to initializeixPluginmessage.spec.ts- validates modal/message removal from DOM (real component)application-breakpoints.spec.ts- validates radio group event handlingResult: Tests fail with broken
ce()helper, pass with fix.🐛 Radio Component Fix: Make
ix-radioDirectly Clickable & AccessibleProblem:
<ix-radio>host element did nothing in unit tests - required accessing shadow DOM directly (works as expected in browser)labelprop wasn't exposed to accessibility tree, breaking Testing Library queries and screen readersSolution:
packages/core/src/components/radio/radio.tsx<Host aria-checked={a11yBoolean(this.checked)} aria-disabled={a11yBoolean(this.disabled)} + aria-label={this.label} role="radio" + onClick={() => !this.disabled && this.setCheckedState(true)} onBlur={() => this.ixBlur.emit()} >Changes:
aria-label={this.label}- Exposes label to accessibility treescreen.findByRole('radio', { name: 'Small' })onClickhandler - Makes entire host element clickable in testssetCheckedState(true)(radios should only be checkable)disabledstateTesting:
🔄 Vue Component Update
packages/vue-test-app/src/preview-examples/application-breakpoints.vueIxRadioGroup@valueChangeevent (single handler)event.detailfromCustomEvent<Breakpoint>