diff --git a/src/Core/Components/MainLayout/FluentMainLayout.razor b/src/Core/Components/MainLayout/FluentMainLayout.razor index 55535b693b..116610820a 100644 --- a/src/Core/Components/MainLayout/FluentMainLayout.razor +++ b/src/Core/Components/MainLayout/FluentMainLayout.razor @@ -7,17 +7,20 @@ @Header - @SubHeader + - - @if (NavMenuContent != null) - { - - @NavMenuContent - - } - - @Body - + @SubHeader + + + @if (NavMenuContent != null) + { + + @NavMenuContent + + } + + @Body + + - \ No newline at end of file + diff --git a/src/Core/Components/MainLayout/FluentMainLayout.razor.cs b/src/Core/Components/MainLayout/FluentMainLayout.razor.cs index 87688dce19..179642fba4 100644 --- a/src/Core/Components/MainLayout/FluentMainLayout.razor.cs +++ b/src/Core/Components/MainLayout/FluentMainLayout.razor.cs @@ -10,7 +10,6 @@ public partial class FluentMainLayout : FluentComponentBase protected string? StyleValue => new StyleBuilder(Style) .AddStyle("--header-height", $"{HeaderHeight}px", () => HeaderHeight.HasValue) - .AddStyle("height", $"calc(100% - {HeaderHeight}px)") .Build(); /// diff --git a/tests/Core/_ToDo/MainLayout/FluentMainLayoutTests.FluentMainLayout_Default.verified.html b/tests/Core/_ToDo/MainLayout/FluentMainLayoutTests.FluentMainLayout_Default.verified.html index 6b813fed9f..9c732e7315 100644 --- a/tests/Core/_ToDo/MainLayout/FluentMainLayoutTests.FluentMainLayout_Default.verified.html +++ b/tests/Core/_ToDo/MainLayout/FluentMainLayoutTests.FluentMainLayout_Default.verified.html @@ -1,27 +1,29 @@ -
-
-
- render me -
-
- render me -
- - \ No newline at end of file diff --git a/tests/Core/_ToDo/MainLayout/FluentMainLayoutTests.cs b/tests/Core/_ToDo/MainLayout/FluentMainLayoutTests.cs index a18a99e611..8db255bff5 100644 --- a/tests/Core/_ToDo/MainLayout/FluentMainLayoutTests.cs +++ b/tests/Core/_ToDo/MainLayout/FluentMainLayoutTests.cs @@ -36,5 +36,35 @@ public void FluentMainLayout_Default() //Assert cut.Verify(); } + + [Fact] + public void FluentMainLayout_MainContent_Should_HaveCorrectHeight() + { + //Arrange + int? headerHeight = 60; + var expectedHeightStyle = $"height: 100%;"; + var header = "render me"; + var subHeader = "render me"; + var navMenuContent = "render me"; + var body = "render me"; + string navMenuTitle = default!; + var navMenuWidth = 320; + var cut = TestContext.RenderComponent(parameters => parameters + .Add(p => p.Header, header) + .Add(p => p.SubHeader, subHeader) + .Add(p => p.HeaderHeight, headerHeight) + .Add(p => p.NavMenuTitle, navMenuTitle) + .Add(p => p.NavMenuContent, navMenuContent) + .Add(p => p.NavMenuWidth, navMenuWidth) + .Add(p => p.Body, body) + ); + //Act + var fullContentStack = cut.FindComponent(); + var mainContentStack = fullContentStack.FindComponent(); + + //Assert + Assert.Equal(expectedHeightStyle, fullContentStack.Instance.Style, StringComparer.Ordinal); + Assert.Equal(expectedHeightStyle, mainContentStack.Instance.Style, StringComparer.Ordinal); + } }