-
Notifications
You must be signed in to change notification settings - Fork 380
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
[Stack] Added 'Stretch' horizontal alignment option #2800
[Stack] Added 'Stretch' horizontal alignment option #2800
Conversation
Introduced a new horizontal alignment option, `Stretch`, to the `FluentStack` component. Updated the `HorizontalAlignment` enum in `HorizontalAlignment.cs` to include the `Stretch` value with a summary comment. Modified the `GetHorizontalAlignment` method in `FluentStack.razor.cs` to map `HorizontalAlignment.Stretch` to the string "stretch".
Good addition. It would really help us if you could add some better unit test for the Stack (pretty please).. |
No problem, I will have a look at that.. |
@microsoft-github-policy-service agree |
I think it's a good idea. Thank you very much. But I don't know if this will be possible in the current version of Lib, because the enumeration is also used with the Dialog component (which should be updated in v5). So, when adding a new attribute, you need to check what the result will be with this component. And update or document it to explain it. |
Good point Denis. Think we can still do it on this version. We just need to do a check in dialog code to see if this invalid value is not being used. We have that on other components as well (button/anchor from the top of my head) |
Yep. But we should add an info message in these component properties to explain that this value is nor applicable. |
The Alignment property now includes a custom setter that throws an ArgumentException if set to HorizontalAlignment.Stretch, ensuring this value is not supported.
I've added a custom setter for the Aligment property of the DialogParameters class that ensures that a vaue of "stretch" can't be set in this context. Could you maybe suggest a suitable place to add a unit test for this? I can see there's a FluentDialogServiceTests class - maybe here? (Sorry I'm not familiar with BUnit) |
Yes that one or FluentDialogTests |
Awesome. Can you add this info about "stretch" in the XML documentation (just above For the unit test, you could read this page: https://github.com/microsoft/fluentui-blazor/blob/dev/docs/unit-tests.md |
I've updated the XML documentation and added a new unit test for the invalid DialogParameters.Alignment value. |
Introduced a new horizontal alignment option,
Stretch
, to theFluentStack
component. Updated theHorizontalAlignment
enum inHorizontalAlignment.cs
to include theStretch
value with a summary comment. Modified theGetHorizontalAlignment
method inFluentStack.razor.cs
to mapHorizontalAlignment.Stretch
to the string "stretch".Pull Request
📖 Description
While using the FluentStack in vertical mode I found that I was unable to set the underlying flexbox "align-items" style to "stretch" as this option was missing from the HorizontalAlignment enum. Therefore I have added "Stretch" to the enum and implemented the option in the GetHorizontalAlignment method of the FluentStack component.
I don't believe this is a breaking change as the default option is still "start".
🎫 Issues
👩💻 Reviewer Notes
To view the change in action visit the /Stack page of the demo and in the "Using the FluentStack component" section select the "Stretch" option in the "Horizonal" options.
This is my very first pull request so apologies if I haven't followed any procedures correctly.
📑 Test Plan
There doesn't appear to be any existing test coverage for these areas.
✅ Checklist
General
Component-specific
⏭ Next Steps