From 15b8bac3cffbe980afefc461eb327be56e421cd0 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Wed, 20 Sep 2023 10:03:19 +0300 Subject: [PATCH] Fix menu redirection to Pages --- .../src/Volo.CmsKit.Domain/Volo/CmsKit/Menus/MenuItemManager.cs | 2 +- .../Menus/MenuItemAdminAppService_Tests.cs | 2 -- .../test/Volo.CmsKit.Domain.Tests/Menus/MenuManager_Test.cs | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Menus/MenuItemManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Menus/MenuItemManager.cs index 4f97e5f112..76d95f175f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Menus/MenuItemManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Menus/MenuItemManager.cs @@ -22,7 +22,7 @@ public class MenuItemManager : CmsKitDomainServiceBase public virtual void SetPageUrl(MenuItem menuItem, Page page) { menuItem.SetPageId(page.Id); - menuItem.SetUrl(page.Slug); + menuItem.SetUrl(page.Slug.EnsureStartsWith('/')); } [UnitOfWork] diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Menus/MenuItemAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Menus/MenuItemAdminAppService_Tests.cs index 20b373c8a8..509070fd7d 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Menus/MenuItemAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Menus/MenuItemAdminAppService_Tests.cs @@ -70,7 +70,6 @@ public class MenuItemAdminAppService_Tests : CmsKitApplicationTestBase }); }); - var menu = await MenuRepository.FindAsync(TestData.MenuItem_1_Id); menu.ShouldNotBeNull(); @@ -83,7 +82,6 @@ public class MenuItemAdminAppService_Tests : CmsKitApplicationTestBase { await MenuAdminAppService.DeleteAsync(TestData.MenuItem_1_Id); - var menu = await MenuRepository.FindAsync(TestData.MenuItem_1_Id); menu.ShouldBeNull(); diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Menus/MenuManager_Test.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Menus/MenuManager_Test.cs index b615b8af46..bcc1612d41 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Menus/MenuManager_Test.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Menus/MenuManager_Test.cs @@ -32,7 +32,7 @@ public class MenuManager_Test : CmsKitDomainTestBase menuManager.SetPageUrl(menuItem, page); menuItem.Url.ShouldNotBeNullOrEmpty(); - menuItem.Url.ShouldBe(page.Slug); + menuItem.Url.ShouldBe(page.Slug.EnsureStartsWith('/')); } [Fact]