/// <summary> /// /// </summary> /// <param name="output"></param> /// <param name="className"></param> public static void RemoveClass(this TagHelperOutput output, string className) { if (string.IsNullOrWhiteSpace(className)) { return; } output.RemoveClass(className, NullHtmlEncoder.Default); }
public void RemoveClass() { var output = new TagHelperOutput("div", new TagHelperAttributeList(), (result, encoder) => { var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.SetHtmlContent(string.Empty); return(Task.FromResult <TagHelperContent>(tagHelperContent)); }); output.AddClass(""); output.Attributes.ContainsName("class").ShouldBeFalse(); output.AddClass("test"); output.Attributes["class"].Value.ShouldBe("test"); output.RemoveClass(""); output.Attributes["class"].Value.ShouldBe("test"); output.RemoveClass("test"); output.Attributes.ContainsName("class").ShouldBeFalse(); }