Repository navigation
Add tests for CSS styles with IsEnabled=false - #32947
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive unit tests for issue #12550, which reported that CSS styles are ignored when an element's IsEnabled property is set to false during initialization. The tests verify that the core CSS/VSM specificity logic works correctly and serve as regression tests to ensure the behavior continues to function properly.
- Adds XAML-based unit tests to verify CSS style application in various enabled/disabled scenarios
- Adds a Core unit test for the basic reproduction case
- All tests pass, indicating the issue is not present in the current codebase
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Controls/tests/Xaml.UnitTests/Issues/Maui12550.xaml.cs |
Test code-behind with three test cases covering CSS application to enabled buttons, re-enabled buttons, and buttons cycled through enable/disable states |
src/Controls/tests/Xaml.UnitTests/Issues/Maui12550.xaml |
XAML markup defining test page with two buttons (one initially disabled, one enabled) and CSS stylesheet reference |
src/Controls/tests/Xaml.UnitTests/Issues/Maui12550.css |
Simple CSS stylesheet applying green background color to all buttons |
src/Controls/tests/Core.UnitTests/StyleSheets/StyleTests.cs |
Core unit test for basic scenario of re-enabling an initially disabled button with CSS styling |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
Adds unit tests for issue #12550 - CSS styles are ignored when element's IsEnabled=false on initialization.
Tests Added
XAML Unit Tests (
Maui12550.xaml/.xaml.cs/.css):CSSStyleAppliedToInitiallyEnabledButton- verifies CSS works on enabled buttonsCSSStyleAppliedAfterReEnablingInitiallyDisabledButton- verifies CSS is applied after re-enabling a button that started disabledCSSStyleAppliedAfterDisableEnableCycle- verifies CSS is preserved through disable/enable cycleCore Unit Test (
StyleTests.cs):CSSStyleAppliedAfterReEnablingInitiallyDisabledButton_Issue12550- basic scenario testTest Results
All tests pass, indicating the core CSS/VSM specificity logic is working correctly. The tests serve as regression tests to ensure this behavior continues to work.
Closes #12550