Skip to content
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

test: Add validation for unfocus on empty space #19827

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MartinZikmund
Copy link
Member

GitHub Issue (If applicable): closes #

PR Type

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@MartinZikmund MartinZikmund requested a review from Copilot April 3, 2025 13:13
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 a test to validate that a button loses focus when tapping on an empty space outside of it.

  • Introduced a new test method "When_Tapped_Empty_Space" in FocusManager tests
  • Configured the test to be ignored on platforms without input injector support

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19827/index.html

@MartinZikmund MartinZikmund requested a review from Copilot April 3, 2025 13:55
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 a new UI test that validates focus behavior when tapping on an empty space outside a button. The key changes include:

  • Removal of an extra empty line in the using directives.
  • Addition of the test method "When_Tapped_Empty_Space" to verify that a button loses focus when the user taps outside it.
  • Implementation of conditional test execution based on platform capabilities.
Comments suppressed due to low confidence (2)

src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Input/Given_FocusManager.cs:300

  • [nitpick] Consider computing the tap coordinates relative to the button's position to reduce the risk of test fragility in different screen layouts or device scales.
TestServices.InputHelper.Tap(new(10, 10));

src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Input/Given_FocusManager.cs:279

  • [nitpick] Consider renaming the test method to 'When_TappedOnEmptySpace' for improved readability.
public async Task When_Tapped_Empty_Space()

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19827/index.html

@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-19827/index.html

@MartinZikmund MartinZikmund self-assigned this Apr 3, 2025
@MartinZikmund MartinZikmund force-pushed the dev/mazi/remove-focus-root branch from 764d311 to 64ebb2e Compare April 4, 2025 13:05
@unodevops
Copy link
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19827/index.html

@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-19827/index.html

MartinZikmund and others added 2 commits April 7, 2025 10:09
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@MartinZikmund MartinZikmund force-pushed the dev/mazi/remove-focus-root branch from 64ebb2e to 77ef263 Compare April 7, 2025 08:10
@unodevops
Copy link
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-19827/index.html

@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-19827/index.html

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.

4 participants