public void ElementWithNameAndNonEmptyValue()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.Element("a", "bcd");
            AssertEx.EqualLines("<a>bcd</a>", builder);
        }
        public void ElementWithNameAndCanBeEmptyElementSetToTrue()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.Element("a", true);
            AssertEx.EqualLines("<a/>", builder);
        }
        public void ElementWithNameAndNullValue()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.Element("a", (string)null);
            AssertEx.EqualLines("<a/>", builder);
        }
        public void DOCTYPE()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.DOCTYPE();
            AssertEx.EqualLines("<!DOCTYPE html>", builder);
        }
        public void ElementWithNameAndCanBeEmptyElementSetToFalse()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.Element("a", false);
            AssertEx.EqualLines("<a></a>", builder);
        }
 public HTMLElement(HTMLBuilder builder, string elementName, bool canBeEmptyElement)
 {
     this.builder           = builder;
     this.elementName       = elementName;
     this.canBeEmptyElement = canBeEmptyElement;
     this.CurrentState      = State.Start;
     builder.Text($"<{elementName}");
 }
        public void ElementWithNoAttributesAndOneChildText()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.Element("a", a =>
            {
                a.Text("b");
            });
            AssertEx.EqualLines("<a>b</a>", builder);
        }
        public void ElementWithOneAttributeAndNoChildren()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.Element("a", a =>
            {
                a.Attribute("b", "c");
            });
            AssertEx.EqualLines("<a b=\"c\"/>", builder);
        }
        public void ScriptWithTSBuilderAction()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.Script(tsBuilder =>
            {
                tsBuilder.ConstQuotedStringVariable("x", "my special text");
            });
            AssertEx.EqualLines(new[]
            {
                "<script type=\"text/javascript\">",
                "  const x = \"my special text\";",
                "</script>"
            },
                                builder);
        }
        public void ElementWithNoAttributesAndOneChildElement()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.Element("a", a =>
            {
                a.ChildElement("b");
            });
            AssertEx.EqualLines(new[]
            {
                "<a>",
                "  <b/>",
                "</a>"
            },
                                builder);
        }
        public void DoctypeHtmlAndHeadElements()
        {
            HTMLBuilder builder = new HTMLBuilder();

            builder.DOCTYPE();
            builder.Html(html =>
            {
                html.Head();
            });
            AssertEx.EqualLines(new[]
            {
                "<!DOCTYPE html>",
                "<html lang=\"en\">",
                "  <head/>",
                "</html>"
            },
                                builder);
        }
        public void Constructor()
        {
            HTMLBuilder builder = new HTMLBuilder();

            AssertEx.EqualLines("", builder);
        }