本文整理汇总了C#中HtmlTag.ToCompacted方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag.ToCompacted方法的具体用法?C# HtmlTag.ToCompacted怎么用?C# HtmlTag.ToCompacted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTag
的用法示例。
在下文中一共展示了HtmlTag.ToCompacted方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: render_a_single_class_even_though_it_is_registered_more_than_once
public void render_a_single_class_even_though_it_is_registered_more_than_once()
{
HtmlTag tag = new HtmlTag("div").Text("text");
tag.AddClass("a");
tag.ToCompacted().ShouldEqual("<div class=\"a\">text</div>");
tag.AddClass("a");
tag.ToCompacted().ShouldEqual("<div class=\"a\">text</div>");
}
示例2: is_visible_set_to_true_by_default
public void is_visible_set_to_true_by_default()
{
var tag = new HtmlTag("div");
tag.Visible().ShouldBeTrue();
tag.ToCompacted().ShouldEqual("<div></div>");
}
示例3: insert_before
public void insert_before()
{
var tag = new HtmlTag("div");
tag.Add("span");
tag.InsertFirst(new HtmlTag("p"));
tag.ToCompacted().ShouldEqual("<div><p></p><span></span></div>");
}
示例4: render_metadata
public void render_metadata()
{
HtmlTag tag = new HtmlTag("div").Text("text");
tag.MetaData("a", 1);
tag.MetaData("b", "b-value");
tag.ToCompacted().ShouldEqual("<div class=\"{'a':1,'b':'b-value'}\">text</div>");
// now with another class
tag.AddClass("class1");
tag.ToCompacted().ShouldEqual("<div class=\"class1 {'a':1,'b':'b-value'}\">text</div>");
}
示例5: render_id
public void render_id()
{
HtmlTag tag = new HtmlTag("div").Id("theDiv");
tag.ToCompacted().ShouldEqual("<div id=\"theDiv\"></div>");
}
示例6: render_a_single_attribute
public void render_a_single_attribute()
{
HtmlTag tag = new HtmlTag("table").Attr("cellPadding", 2);
tag.ToCompacted().ShouldEqual("<table cellPadding=\"2\"></table>");
}
示例7: prepend
public void prepend()
{
HtmlTag tag = new HtmlTag("div").Text("something");
tag.Prepend("more in front ");
tag.ToCompacted().ShouldEqual("<div>more in front something</div>");
}
示例8: the_inner_text_is_html_encoded
public void the_inner_text_is_html_encoded()
{
var tag = new HtmlTag("div");
tag.Text("<b>Hi</b>");
tag.ToCompacted().ShouldEqual("<div><b>Hi</b></div>");
}
示例9: render_tag_with_one_child
public void render_tag_with_one_child()
{
HtmlTag tag = new HtmlTag("div").Child(new HtmlTag("span").Text("something"));
tag.ToCompacted().ShouldEqual("<div><span>something</span></div>");
}
示例10: render_multiple_levels_of_nesting_2
public void render_multiple_levels_of_nesting_2()
{
HtmlTag tag = new HtmlTag("html").With(x =>
{
x.Add("head", head =>
{
head.Add("title").Text("The title");
head.Add("style").Text("the style");
});
x.Add("body/div").Text("inner text of div");
});
tag.ToCompacted().ShouldEqual(
"<html><head><title>The title</title><style>the style</style></head><body><div>inner text of div</div></body></html>");
}
示例11: render_multiple_levels_of_nesting
public void render_multiple_levels_of_nesting()
{
var tag = new HtmlTag("table");
tag.Add("tbody/tr/td").Text("some text");
tag.ToCompacted()
.ShouldEqual("<table><tbody><tr><td>some text</td></tr></tbody></table>");
}
示例12: render_multiple_classes
public void render_multiple_classes()
{
HtmlTag tag = new HtmlTag("div").Text("text");
tag.AddClass("a");
tag.AddClass("b");
tag.AddClass("c");
tag.ToCompacted().ShouldEqual("<div class=\"a b c\">text</div>");
}
示例13: render_multiple_attributes
public void render_multiple_attributes()
{
HtmlTag tag = new HtmlTag("table").Attr("cellPadding", "2").Attr("cellSpacing", "3");
tag.ToCompacted().ShouldEqual("<table cellPadding=\"2\" cellSpacing=\"3\"></table>");
}
示例14: render_multiple_classes_with_a_single_method_call
public void render_multiple_classes_with_a_single_method_call()
{
HtmlTag tag = new HtmlTag("div").Text("text");
tag.AddClasses("a", "b", "c");
tag.ToCompacted().ShouldEqual("<div class=\"a b c\">text</div>");
}