Skip to content

Commit

Permalink
[Layout] Add Id to the container div (#2123)
Browse files Browse the repository at this point in the history
* Add Id to the container div in FluentLayout.razor

* Add FluentLayout_Id test to ensure Id is rendered when supplied.

* solve the following warning by fixing version
microsoft\fluentui-blazor\tests\Core\Microsoft.FluentUI.AspNetCore.Components.Tests.csproj : warning NU1603: Microsoft.FluentUI.AspNetCore.Components.Tests depends on FluentAssertions (>= 7.0.0-
tags-7.0.0-tags-7-0-0-alpha-3.1) but FluentAssertions 7.0.0-tags-7.0.0-tags-7-0-0-alpha-3.1 was not found. An approximate best match of FluentAssertions 7.0.0-tags-7-0-0-alpha-3.1 was resolved.

* Add test verification file
  • Loading branch information
StevenTCramer authored May 30, 2024
1 parent f60fc4b commit 581ca02
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
<PackageVersion Include="System.Text.Json" Version="8.0.3" />
<!-- Test dependencies -->
<PackageVersion Include="bunit" Version="1.28.9" />
<PackageVersion Include="FluentAssertions" Version="7.0.0-alpha.3" />
<PackageVersion Include="FluentAssertions" Version="7.0.0-tags-7.0.0-tags-7-0-0-alpha-3.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="xunit" Version="2.8.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.0" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Core/Components/Layout/FluentLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@inherits FluentComponentBase

<div @ref=Element class="@ClassValue" style="@StyleValue" orientation="@_orientation" @attributes="AdditionalAttributes">
<div @ref=Element id="@Id" class="@ClassValue" style="@StyleValue" orientation="@_orientation" @attributes="AdditionalAttributes">
@ChildContent
</div>

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<div id="xxx" class="layout" b-emdrz8ckod="" blazor:elementreference="xxx"></div>
13 changes: 13 additions & 0 deletions tests/Core/Layout/FluentLayoutTests.razor
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@
cut.Verify();
}

[Fact]
public void FluentLayout_Id()
{
//Arrange
var cut = Render(@<FluentLayout Id="42" />);

//Act
//Assert
cut.Verify();
}


[Fact]
public void FluentLayout_AdditionalProperties()
{
Expand Down

0 comments on commit 581ca02

Please sign in to comment.