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]