-
Notifications
You must be signed in to change notification settings - Fork 481
Enable developers to inherit from BaseBehavior and BaseConverter again #2573
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
Enable developers to inherit from BaseBehavior and BaseConverter again #2573
Conversation
|
Thanks Shaun! This is good to go once we have a docs PR 🙌 |
Thanks. I haven't added tests for converters yet either but I will get onto that |
There was a problem hiding this 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 re-enables developers to inherit from BaseBehavior and BaseConverter by removing restrictive constructors and adding comprehensive unit tests for the behavior functionality.
- Removed explicit private protected constructors from BaseBehavior and BaseConverter to allow inheritance.
- Introduced new unit tests and a MockBehavior implementation to verify attachment, detachment, and property change handling.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/CommunityToolkit.Maui.UnitTests/Behaviors/BaseBehaviorTests.cs | Added unit tests verifying behavior attachment, detachment, and property change propagation. |
| src/CommunityToolkit.Maui.UnitTests/Mocks/MockBehavior.cs | Added MockBehavior class to support testing with custom assertions on the view and property changes. |
| src/CommunityToolkit.Maui/Behaviors/BaseBehavior.shared.cs | Removed redundant private protected constructor to enable inheritance. |
| src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs | Removed redundant private protected constructor to enable inheritance. |
…' of github.com:CommunityToolkit/Maui into feature/sl-open-up-converters-and-behavior-base-classes
Description of Change
This PR opens up the ability to inherit from both
BaseBehaviorandBaseConverter. It includes unit testing to cover the functionality that we expose in order to make it safe to use.Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information