medly / medly-components

🧩 Medly components provides numerous themable react components, each with multiple varitaions of sizes, colors, position etc.
https://medly.github.io/medly-components/
MIT License
79 stars 54 forks source link

fix(core): single select focus Issue #721

Closed Bhusnar5044 closed 1 year ago

Bhusnar5044 commented 1 year ago

PR Checklist

Description

This PR fixes issue #720

Type of change

How has this been tested?

(Replace This Text: Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.)

[ ] Test A

[ ] Test B

Fixes #720

What is the current behaviour?

the focus stays on the field when user select option and click outside the single select field

What is the new behaviour?

removed focus on the field when we user selects option and click outside the single select field

Does this PR introduce a breaking change?

Note: (Replace This Text: If this PR contains a breaking change please describe the impact and migration path for existing application.)

Additional context

(Replace This Text: Please describe any other related information or add screenshots of the PR.)

Checklist

nx-cloud[bot] commented 1 year ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 5d990f213c1bde4f7fe665d76d87785bdfa5a99a. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 2 targets - [`lerna run build`](https://cloud.nx.app/runs/wP7Hl75CQS) - [`lerna run lint`](https://cloud.nx.app/runs/WDNx7GRM3B)

Sent with 💌 from NxCloud.

gmukul01 commented 1 year ago

@Bhusnar5044 I am merging this PR to unblock you, but could you please raise another PR to remove the duplicate code.

sonarcloud[bot] commented 1 year ago

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
86.5% 86.5% Duplication

Bhusnar5044 commented 1 year ago

@Bhusnar5044 I am merging this PR to unblock you, but could you please raise another PR to remove the duplicate code.

@gmukul01 sonarCloud showing duplications in the test file, it's showing duplications for lines. not sure how to fix it.

gmukul01 commented 1 year ago

@Bhusnar5044 Actually we have to extract out the common lines which selects one of the option in the SingleSelect. For example below lines are common accross all the tests.

fireEvent.focus(screen.getByRole('textbox'));
fireEvent.keyDown(container, { key: 'ArrowDown', code: 40 });
fireEvent.keyDown(container, { key: 'Enter', code: 13 });