Esempio n. 1
0
 private static void RemoveAttribute(ElementFragment elFragment, string attribute)
 {
     if (elFragment.HasAttributes && elFragment.Attributes[attribute] != null)
     {
         elFragment.Attributes.Remove(attribute);
     }
 }
Esempio n. 2
0
            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");
            }
Esempio n. 3
0
            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");
            }
Esempio n. 4
0
            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);
            }
Esempio n. 5
0
        private static void AddClassAttribute(string originalTag, ElementFragment elFragment, int numTableColumns)
        {
            var classAttribute = GetCssClass(originalTag, numTableColumns);

            if (classAttribute != null)
            {
                elFragment.Attributes.Add(classAttribute);
            }
        }
Esempio n. 6
0
            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");
            }
Esempio n. 12
0
 private static void RemoveAttribute(ElementFragment elFragment, string attribute)
 {
     if (elFragment.HasAttributes && elFragment.Attributes[attribute] != null)
     {
         elFragment.Attributes.Remove(attribute);
     }
 }
Esempio n. 13
0
        private static void AddClassAttribute(string originalTag, ElementFragment elFragment, int numTableColumns)
        {
            var classAttribute = GetCssClass(originalTag, numTableColumns);

            if (classAttribute != null)
                elFragment.Attributes.Add(classAttribute);
        }
Esempio n. 14
0
            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);
            }