Skip to content

Conversation

@bijington
Copy link
Contributor

@bijington bijington commented Mar 7, 2025

Description of Change

This PR opens up the ability to inherit from both BaseBehavior and BaseConverter. It includes unit testing to cover the functionality that we expose in order to make it safe to use.

Linked Issues

  • Fixes #

PR Checklist

Additional information

@TheCodeTraveler TheCodeTraveler added pending documentation This feature requires documentation approved This Proposal has been approved and is ready to be added to the Toolkit labels Mar 7, 2025
@TheCodeTraveler
Copy link
Collaborator

Thanks Shaun! This is good to go once we have a docs PR 🙌

@bijington
Copy link
Contributor Author

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

@TheCodeTraveler TheCodeTraveler requested a review from Copilot March 12, 2025 23:04
Copy link
Contributor

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 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.

bijington and others added 3 commits March 14, 2025 15:27
@bijington bijington removed the pending documentation This feature requires documentation label Mar 17, 2025
@bijington bijington merged commit e17d471 into main Mar 21, 2025
10 checks passed
@bijington bijington deleted the feature/sl-open-up-converters-and-behavior-base-classes branch March 21, 2025 20:21
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved This Proposal has been approved and is ready to be added to the Toolkit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants