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

Remove Switch On/Off content #20487

Merged
merged 2 commits into from
Feb 29, 2024
Merged

Conversation

dotMorten
Copy link
Contributor

@dotMorten dotMorten commented Feb 10, 2024

Description of Change

Removes the default On/Off text on the Windows ToggleSwitch. This brings consistency with iOS and Android, and avoids issues with not being able to style the text.

Issues Fixed

Fixes #20486

I've validated the fix with the Sandbox app. I'd love to add some unit tests too, but need a little guidance wrt where to put that, and how to verify that it no longer renders the text.

Brings consistency with iOS and Android
@dotMorten dotMorten requested a review from a team as a code owner February 10, 2024 01:19
@ghost ghost added the community ✨ Community Contribution label Feb 10, 2024
@ghost
Copy link

ghost commented Feb 10, 2024

Hey there @dotMorten! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Feb 12, 2024
Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

Hi Morten,

You have different ways to validate it with tests.
On the one hand, you can create a DeviceTests here https://github.com/dotnet/maui/blob/main/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.Windows.cs#L16
Using xUnit you can create a test similar to https://github.com/dotnet/maui/blob/main/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.cs#L14 where with a method you access the ToggleSwitch and you validate that the OffContent and OnContent properties are null.
You can also create a UITest, creating a golden test where a reference snapshot is created and the test compares each screenshot pixel by pixel with the reference. Example:

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

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

Can you retarget this for net9.0?

@dotMorten dotMorten changed the base branch from main to net9.0 February 13, 2024 00:03
@dotMorten
Copy link
Contributor Author

@PureWeen Done!

@rmarinho rmarinho requested a review from PureWeen February 13, 2024 00:45
rmarinho
rmarinho previously approved these changes Feb 13, 2024
@rmarinho
Copy link
Member

Needs some kind of testing, think a UITest with a screenshot is fine

@jsuarezruiz
Copy link
Contributor

Added Device Test.

@jsuarezruiz jsuarezruiz requested review from jsuarezruiz and davidortinau and removed request for jsuarezruiz February 21, 2024 15:09
@rmarinho rmarinho merged commit 3fc8b6a into dotnet:net9.0 Feb 29, 2024
40 of 42 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2024
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows: Switch shows On/OffContent text
6 participants