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

Question: How to test environment-set state? #359

Open
jonreid opened this issue Dec 11, 2024 · 2 comments
Open

Question: How to test environment-set state? #359

jonreid opened this issue Dec 11, 2024 · 2 comments

Comments

@jonreid
Copy link
Contributor

jonreid commented Dec 11, 2024

Alexey, sorry to trouble you again. I have a situation and have created a minimal repro here: https://github.com/jonreid/EnableDemo

I want a custom button to change its color depending on whether it's enabled or disabled via @Environment(\.isEnabled).

The code works when I run it.

The tests for disabled/enabled state work, from toggling a switch.

But test_customButtonDisabledColor fails, the test for the color of the disabled state. What trick am I missing?

Thanks in advance… Jon

@jonreid jonreid changed the title Question: How to test environment-set color? Question: How to test environment-set state? Dec 11, 2024
@nalexn
Copy link
Owner

nalexn commented Dec 11, 2024

Hey, that might be caused by #131

@jonreid
Copy link
Contributor Author

jonreid commented Dec 12, 2024

Ahhh, is this because it's not arbitrary @Environment we control, but there is hidden Apple code setting it that we can't trigger?

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

No branches or pull requests

2 participants