Skip to content

Commit

Permalink
Accordion: change parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
vnbaaij committed Nov 13, 2023
1 parent c81efc3 commit bea8d06
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentAccordionItem.Heading">
<summary>
Gets or sets the heading of the accordion item.
Use either this or the <see cref="P:Microsoft.FluentUI.AspNetCore.Components.FluentAccordionItem.HeadingTemplate"/> parameter."/>
If both are set, this parameter will be used.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentAccordionItem.HeadingContent">
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentAccordionItem.HeadingTemplate">
<summary>
Gets or sets the heading content of the accordion item.
Use either this or the <see cref="P:Microsoft.FluentUI.AspNetCore.Components.FluentAccordionItem.Heading"/> parameter."/>
If both are set, this parameter will not be used.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentAccordionItem.Expanded">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
Panel three content
</FluentAccordionItem>
<FluentAccordionItem Expanded="true">
<HeadingContent>
<HeadingTemplate>
Panel <span style="color:red">Four</span>
</HeadingContent>
</HeadingTemplate>
<ChildContent>
Panel four content
</ChildContent>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Components/Accordion/FluentAccordionItem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
else
{
<div slot="heading">
@HeadingContent
@HeadingTemplate
</div>
}
@ChildContent
Expand Down
6 changes: 5 additions & 1 deletion src/Core/Components/Accordion/FluentAccordionItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ public partial class FluentAccordionItem : FluentComponentBase, IDisposable

/// <summary>
/// Gets or sets the heading of the accordion item.
/// Use either this or the <see cref="HeadingTemplate"/> parameter."/>
/// If both are set, this parameter will be used.
/// </summary>
[Parameter]
public string? Heading { get; set; }

/// <summary>
/// Gets or sets the heading content of the accordion item.
/// Use either this or the <see cref="Heading"/> parameter."/>
/// If both are set, this parameter will not be used.
/// </summary>
[Parameter]
public RenderFragment? HeadingContent { get; set; }
public RenderFragment? HeadingTemplate { get; set; }

/// <summary>
/// Expands or collapses the item.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<fluent-accordion-item id="xxx" blazor:elementreference="xxx">
<div slot="heading"></div>
</fluent-accordion-item>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<fluent-accordion-item id="xxx" blazor:elementreference="xxx">
<div slot="heading">custom heading content</div>
</fluent-accordion-item>
12 changes: 6 additions & 6 deletions tests/Core/Accordion/FluentAccordionItemTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public void FluentAccordionItem_WithCustomHeaderValue()
}

[Fact]
public void FluentAccordionItem_WithHeadingContentAndHeading_IsProvidedBoth()
public void FluentAccordionItem_WithHeadingTemplateAndHeading_IsProvidedBoth()
{
// Arrange & Act
var cut = TestContext.RenderComponent<FluentAccordionItem>(parameters =>
{
parameters.Add(p => p.HeadingContent, context =>
parameters.Add(p => p.HeadingTemplate, context =>
{
context.AddContent(0, "custom heading content");
});
Expand Down Expand Up @@ -145,25 +145,25 @@ public void FluentAccordionItem_WhenAdditionalStyle_IsProvided()
}

[Fact]
public void FluentAccordionItem_WithHeadingContent_IsNull()
public void FluentAccordionItem_WithHeadingTemplate_IsNull()
{
// Arrange & Act
var cut = TestContext.RenderComponent<FluentAccordionItem>(parameters =>
{
parameters.Add(p => p.HeadingContent, context => { });
parameters.Add(p => p.HeadingTemplate, context => { });
});

// Assert
cut.Verify();
}

[Fact]
public void FluentAccordionItem_WithHeadingContent_IsProvided()
public void FluentAccordionItem_WithHeadingTemplate_IsProvided()
{
// Arrange & Act
var cut = TestContext.RenderComponent<FluentAccordionItem>(parameters =>
{
parameters.Add(p => p.HeadingContent, context =>
parameters.Add(p => p.HeadingTemplate, context =>
{
context.AddContent(0, "custom heading content");
});
Expand Down

0 comments on commit bea8d06

Please sign in to comment.