Skip to content

✨ Quality: test coverage - Dialog component branch logic - #91

Merged
galiprandi merged 1 commit into
mainfrom
quality-dialog-tests-8957963541406261672
Jun 14, 2026
Merged

✨ Quality: test coverage - Dialog component branch logic#91
galiprandi merged 1 commit into
mainfrom
quality-dialog-tests-8957963541406261672

Conversation

@galiprandi

Copy link
Copy Markdown
Owner

I have improved the test coverage for the Dialog component.

💡 What

Added new unit tests to lib/components/Dialog/index.test.tsx that exercise previously uncovered branch logic in the handleClick method and verify that optional callbacks (onOpen, onClose) are handled safely when omitted.

🎯 Why

The branch coverage for the Dialog component was at 92%, leaving some edge cases in the event handling logic untested. Specifically, the "falsy" branches for closeOnBackdropClick and behavior !== 'modal' were not covered.

📊 Impact

  • Increased branch coverage for lib/components/Dialog/index.tsx from 92% to 96%.
  • Improved robustness of the Dialog component by ensuring it behaves correctly when optional props are missing.
  • Aligned the test suite with the project's quality goal of achieving 100% branch coverage for optional callbacks and defensive logic.

✅ Verification

  • Ran pnpm test lib/components/Dialog/index.test.tsx (all tests passed).
  • Ran pnpm test:coverage and confirmed the coverage increase for the Dialog component.
  • Ran pnpm eslint and npx prettier on the modified file.

PR created automatically by Jules for task 8957963541406261672 started by @galiprandi

Improves branch coverage for the Dialog component by adding test cases for:
- Optional onOpen and onClose callbacks
- handleClick early return when closeOnBackdropClick is false
- handleClick early return when behavior is 'dialog'

Branch coverage for lib/components/Dialog/index.tsx increased from 92% to 96%.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@galiprandi
galiprandi merged commit 1dc1817 into main Jun 14, 2026
4 checks passed
@galiprandi
galiprandi deleted the quality-dialog-tests-8957963541406261672 branch June 15, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant