-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
feat (v18): Modernize toggleswitch and expand test #16598
feat (v18): Modernize toggleswitch and expand test #16598
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
trueValue = input<boolean, any>(true, { transform: booleanAttribute }); | ||
/** | ||
* Value in unchecked state. | ||
* @group Props | ||
*/ | ||
@Input() falseValue: any = false; | ||
falseValue = input<boolean, any>(false, { transform: booleanAttribute }); | ||
/** | ||
* Used to define a string that autocomplete attribute the current element. | ||
* @group Props | ||
*/ |
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.
should't be transformed to boolean. These options give us ability to use different checked and unchecked values other than true
and false
. It can be string, number, ... anything.
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.
Thanks @vladovelichkovski for your feedback! I just address it in my last commit.
# Conflicts: # packages/primeng/src/toggleswitch/toggleswitch.spec.ts # packages/primeng/src/toggleswitch/toggleswitch.ts
Refactor:
Updated the ToggleSwitch component to leverage Angular's new signal-based inputs for enhanced reactivity and performance optimization.
Test Cases: Added comprehensive test cases to cover:
Dynamic input handling (label, icon, image)
Inline styles and CSS class binding
Size variations (normal, large, xlarge)
Shape variations (square, circle)
Error handling for image loading
Accessibility (aria-label, aria-labelledby)
Custom styling and class inputs (styleClass, style)
Fix #16546