Skip to content

Conversation

GrabowskiM
Copy link
Contributor

🎫 Issue IBX-10695

Description:

For QA:

Documentation:

@GrabowskiM GrabowskiM requested review from a team and Copilot September 24, 2025 12:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive test coverage for RadioButton components using Storybook test stories. The changes focus on adding behavioral tests that verify user interactions and component state changes.

  • Adds test stories for RadioButtonsListField component to verify selection behavior
  • Enhances existing test stories for RadioButtonInput and RadioButtonField components with more detailed assertions
  • Improves test descriptions and adds proper type annotations for better test reliability

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
RadioButtonsListField.test.stories.tsx New test file covering radio button list selection and onChange behavior
RadioButtonInput.test.stories.tsx Enhanced test assertions and improved step descriptions
RadioButtonField.test.stories.tsx Added comprehensive test scenarios including label interaction and duplicate assertions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

});

await step('Radio Button handles blur event', async () => {
await step('Click outside checkbox', async () => {
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The step description mentions 'checkbox' but this is testing a radio button component. It should be 'Click outside radio button'.

Suggested change
await step('Click outside checkbox', async () => {
await step('Click outside radio button', async () => {

Copilot uses AI. Check for mistakes.

Comment on lines 46 to +50
await expect(args.onFocus).toHaveBeenCalledOnce();
await expect(args.onChange).toHaveBeenCalledOnce();
await expect(args.onChange).toHaveBeenLastCalledWith(true, expect.anything());
await expect(args.onInput).toHaveBeenCalledOnce();
await expect(args.onInput).toHaveBeenLastCalledWith(true, expect.anything());
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertions expect onFocus, onChange, and onInput to be called only once each, but this is the second click on the radio button. Radio buttons typically don't trigger onChange/onInput events when clicked again if already selected, so these call counts should reflect the cumulative calls from both steps.

Copilot uses AI. Check for mistakes.

Comment on lines +87 to +90
await expect(args.onChange).toHaveBeenCalledOnce();
await expect(args.onChange).toHaveBeenLastCalledWith(true, expect.anything());
await expect(args.onInput).toHaveBeenCalledOnce();
await expect(args.onInput).toHaveBeenLastCalledWith(true, expect.anything());
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous issue, these assertions expect onChange and onInput to be called only once total, but this is the second interaction (clicking the label again). The call counts should reflect cumulative calls or be adjusted based on expected radio button behavior.

Copilot uses AI. Check for mistakes.

@ezrobot ezrobot requested review from tischsoic, dew326, OstafinL, RopRaptor and albozek and removed request for a team September 24, 2025 15:01
@dew326 dew326 merged commit 3f42bca into main Oct 1, 2025
11 of 13 checks passed
@dew326 dew326 deleted the IBX-10695-radiobutton-tests branch October 1, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants