public void Add_new_attribute_using_a_lambda() { var h = new HtmlAttributes(href => "http://url/"); h.Attr(data_value => "val"); Assert.That(h.ToHtmlString(), Is.EqualTo(" data-value=\"val\" href=\"http://url/\"")); }
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\"")); }
public void Replace_attributes_with_empty_string_when_null_value_added_using_key_value([Values(1, 2)] int setMethod) { var h = new HtmlAttributes(name => "Old"); switch (setMethod) { case 1: h.Attr(name => null); break; case 2: h.Attr("name", null); break; } Assert.That(h.ToHtmlString(), Is.EqualTo(" name=\"\"")); }
public void Replace_existing_attribute_using_a_lambda() { var h = new HtmlAttributes(href => "http://url/"); h.Attr(href => "newhref"); Assert.That(h.ToHtmlString(), Is.EqualTo(" href=\"newhref\"")); }