private static void RemoveAttribute(ElementFragment elFragment, string attribute) { if (elFragment.HasAttributes && elFragment.Attributes[attribute] != null) { elFragment.Attributes.Remove(attribute); } }
public void it_should_not_add_class_attribute_when_pass_class_attribute_false() { var fragment = new ElementFragment {Name = "table"}; var result = XFormHelper.CleanupXFormHtmlMarkup(fragment, false); result.As<ElementFragment>().Attributes.Should().NotContain(x => x.Name == "class"); }
public void it_should_return_div_fragment_when_pass_table_fragment(string tagName) { var fragment = new ElementFragment {Name = tagName}; var result = XFormHelper.CleanupXFormHtmlMarkup(fragment); result.Name.Should().Be("div"); }
public void it_should_return_fragment_with_same_name_when_pass_non_table_fragment() { var fragment = new ElementFragment {Name = "span"}; var result = XFormHelper.CleanupXFormHtmlMarkup(fragment); result.Name.Should().Be(fragment.Name); }
private static void AddClassAttribute(string originalTag, ElementFragment elFragment, int numTableColumns) { var classAttribute = GetCssClass(originalTag, numTableColumns); if (classAttribute != null) { elFragment.Attributes.Add(classAttribute); } }
public void it_should_remove_valign_attribute() { var fragment = new ElementFragment {Name = "table"}; fragment.Attributes.Add(new AttributeFragment {Name = "valign"}); var result = XFormHelper.CleanupXFormHtmlMarkup(fragment); result.As<ElementFragment>().Attributes.Should().NotContain(x => x.Name == "valign"); }
public void it_should_not_add_class_attribute_when_pass_class_attribute_false() { var fragment = new ElementFragment { Name = "table" }; var result = XFormHelper.CleanupXFormHtmlMarkup(fragment, false); result.As <ElementFragment>().Attributes.Should().NotContain(x => x.Name == "class"); }
public void it_should_return_div_fragment_when_pass_table_fragment(string tagName) { var fragment = new ElementFragment { Name = tagName }; var result = XFormHelper.CleanupXFormHtmlMarkup(fragment); result.Name.Should().Be("div"); }
public void it_should_return_fragment_with_same_name_when_pass_non_table_fragment() { var fragment = new ElementFragment { Name = "span" }; var result = XFormHelper.CleanupXFormHtmlMarkup(fragment); result.Name.Should().Be(fragment.Name); }
public void it_should_add_table_class_attribute_for_table_element(string tagName, string expectedClassName) { var fragment = new ElementFragment { Name = tagName }; var result = XFormHelper.CleanupXFormHtmlMarkup(fragment); result.As <ElementFragment>() .Attributes.Should() .Contain(x => x.Name == "class" && x.Value == expectedClassName); }
public void it_should_remove_valign_attribute() { var fragment = new ElementFragment { Name = "table" }; fragment.Attributes.Add(new AttributeFragment { Name = "valign" }); var result = XFormHelper.CleanupXFormHtmlMarkup(fragment); result.As <ElementFragment>().Attributes.Should().NotContain(x => x.Name == "valign"); }
private static void AddClassAttribute(string originalTag, ElementFragment elFragment, int numTableColumns) { var classAttribute = GetCssClass(originalTag, numTableColumns); if (classAttribute != null) elFragment.Attributes.Add(classAttribute); }
public void it_should_add_table_class_attribute_for_table_element(string tagName, string expectedClassName) { var fragment = new ElementFragment {Name = tagName}; var result = XFormHelper.CleanupXFormHtmlMarkup(fragment); result.As<ElementFragment>() .Attributes.Should() .Contain(x => x.Name == "class" && x.Value == expectedClassName); }