public void Should_return_the_ArrowCircleDown_icon_in_the_outline_style() { // Given / When var icon = IconList.Outline(IconSymbol.ArrowCircleDown); // Then icon.Path.ShouldBe("<path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M15 13l-3 3m0 0l-3-3m3 3V8m0 13a9 9 0 110-18 9 9 0 010 18z\"/>"); icon.ViewBox.ShouldBe("0 0 24 24"); icon.StrokeWidth.ShouldBe("2"); }
public override void Process(TagHelperContext context, TagHelperOutput output) { if (context is null) { throw new ArgumentNullException(nameof(context)); } if (output is null) { throw new ArgumentNullException(nameof(output)); } var isSolid = context.TagName.Equals("heroicon-solid", StringComparison.OrdinalIgnoreCase); var icon = isSolid ? IconList.Solid(Icon) : IconList.Outline(Icon); output.TagMode = TagMode.StartTagAndEndTag; output.TagName = "svg"; if (isSolid) { output.Attributes.SetAttribute("fill", "currentColor"); } else { output.Attributes.SetAttribute("fill", "none"); output.Attributes.SetAttribute("stroke", "currentColor"); output.Attributes.SetAttribute("stroke-width", StrokeWidth ?? icon.StrokeWidth); } output.Attributes.SetAttribute("viewbox", icon.ViewBox); output.Content.AppendHtml(icon.Path); if (_settings.IncludeComments) { output.PreElement.AppendHtml("<!-- Heroicon name: "); output.PreElement.AppendHtml(isSolid ? "solid" : "outline"); output.PreElement.AppendHtml(" "); output.PreElement.Append(icon.Name); output.PreElement.AppendHtml(" -->"); } }