public void Replace_and_add_attributes_using_anonymous_object() { var h = new HtmlAttributes(data_existing => "old"); h.Attrs(new { data_existing = "new", data_new = "newnew" }); Assert.That(h.ToHtmlString(), Is.EqualTo(" data-existing=\"new\" data-new=\"newnew\"")); }
public void Replace_and_add_attributes_using_lambdas() { var h = new HtmlAttributes(data_existing => "old"); h.Attrs(data_existing => "new", data_new => "newnew"); Assert.That(h.ToHtmlString(), Is.EqualTo(" data-existing=\"new\" data-new=\"newnew\"")); }
public void Replace_and_add_attributes_using_dictionary() { var h = new HtmlAttributes(data_existing => "old"); h.Attrs(new Dictionary <string, object> { { "data-existing", "new" }, { "data-new", "newnew" } }); Assert.That(h.ToHtmlString(), Is.EqualTo(" data-existing=\"new\" data-new=\"newnew\"")); }
public void Ensure_merged_attributes_are_case_sensitive([Values(1, 2, 3)] int setMethod) { var h = new HtmlAttributes(name => "Old"); switch (setMethod) { case 1: h.Attr(Name => "honey-badger"); break; case 2: h.Attr("Name", "honey-badger"); break; case 3: h.Attrs(new { Name = "honey-badger" }); break; } Assert.That(h.ToHtmlString(), Is.EqualTo(" name=\"honey-badger\"")); }
/// <inheritdoc /> public IFieldConfiguration Attrs(params Func <object, object>[] attributes) { Attributes.Attrs(attributes); return(this); }