From e1d287ba1409919a3db4977292d959768530dff2 Mon Sep 17 00:00:00 2001 From: "AI\\jvermeyl" Date: Tue, 18 Nov 2025 12:37:32 +0100 Subject: [PATCH] RadzenTocItem: take in attributes to pass on to the list item element --- Radzen.Blazor.Tests/TocTests.cs | 27 ++++++++++++++++++++ Radzen.Blazor/RadzenTocItem.razor | 2 +- Radzen.Blazor/RadzenTocItem.razor.cs | 37 ++++++++++++++++++++++++---- 3 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 Radzen.Blazor.Tests/TocTests.cs diff --git a/Radzen.Blazor.Tests/TocTests.cs b/Radzen.Blazor.Tests/TocTests.cs new file mode 100644 index 00000000000..ad1d66c3626 --- /dev/null +++ b/Radzen.Blazor.Tests/TocTests.cs @@ -0,0 +1,27 @@ +using Bunit; +using System.Collections.Generic; +using Xunit; + +namespace Radzen.Blazor.Tests +{ + public class TocTests + { + [Fact] + public void TocItem_Renders_With_Attributes() + { + using var ctx = new TestContext(); + var component = ctx.RenderComponent(parameters => + { + parameters.Add(p => p.Attributes, new Dictionary + { + { "data-enhance-nav", "false" }, + { "aria-label", "Table of Contents Item" } + }); + }); + + Assert.Contains("data-enhance-nav=\"false\"", component.Markup); + Assert.Contains("aria-label=\"Table of Contents Item\"", component.Markup); + } + } +} + diff --git a/Radzen.Blazor/RadzenTocItem.razor b/Radzen.Blazor/RadzenTocItem.razor index 6d32280a217..f3292f17f3c 100644 --- a/Radzen.Blazor/RadzenTocItem.razor +++ b/Radzen.Blazor/RadzenTocItem.razor @@ -1,4 +1,4 @@ -