public void find_index_walks_up_top() { a.AppendChild(b); b.AppendChild(c); c.AppendChild(d); d.AppendChild(e); e.FindIndex().ShouldEqual(a); d.FindIndex().ShouldEqual(a); c.FindIndex().ShouldEqual(a); b.FindIndex().ShouldEqual(a); a.FindIndex().ShouldBeNull(); }
public TopRightTopicNavigationTag(TopicNode node) : base("ul") { AddClass("nav"); Style("float", "right"); var previous = node.FindPrevious(); if (previous != null) { Add("li/a") .Attr("href", previous.Url) .Text("Previous") .Attr("title", previous.Title); } var next = node.FindNext(); if (next != null) { Add("li/a") .Attr("href", next.Url) .Text("Next") .Attr("title", next.Title); } var index = node.FindIndex(); if (index != null && !ReferenceEquals(node, index)) { Add("li/a") .Attr("href", index.Url) .Text("Index") .Attr("title", index.Title); } }