public HtmlTag BuildInPlaceHierarchyFor(ISpecNode node) { var active = BuildActiveTag(node); var builder = new ChildTagBuilder(this, active.Add("ul")); builder.AddChildren(node); var currentTag = active; while (node.Parent() != null) { var parentTag = BuildLeafTag(node.Parent()); parentTag.Add("ul").Append(currentTag); currentTag = parentTag; node = node.Parent(); } if (node is SpecificationGraph) { return(new HtmlTag("ul").Append(currentTag).Id("all-specs-node").AddClass("filetree")); } var topTag = TopTag(new HtmlTag("ul").Append(currentTag)); return(topTag); }
public HtmlTag BuildInPlaceHierarchyFor(ISpecNode node) { var active = BuildActiveTag(node); var builder = new ChildTagBuilder(this, active.Add("ul")); builder.AddChildren(node); var currentTag = active; while (node.Parent() != null) { var parentTag = BuildLeafTag(node.Parent()); parentTag.Add("ul").Append(currentTag); currentTag = parentTag; node = node.Parent(); } if (node is SpecificationGraph) { return new HtmlTag("ul").Append(currentTag).Id("all-specs-node").AddClass("filetree"); } var topTag = TopTag(new HtmlTag("ul").Append(currentTag) ); return topTag; }
public HtmlTag BuildActiveTag(ISpecNode node) { return(new HtmlTag("li", x => { string text = node.Path().Parts.LastOrDefault() ?? "All Specs"; x.Add("span").AddClass("active").Text(text).AddClass(node.TreeClass); })); }
public HtmlTag BuildActiveTag(ISpecNode node) { return new HtmlTag("li", x => { string text = node.Path().Parts.LastOrDefault() ?? "All Specs"; x.Add("span").AddClass("active").Text(text).AddClass(node.TreeClass); }); }
public HtmlTag BuildLeafTag(ISpecNode node) { return(new HtmlTag("li", tag => { var url = _urls.UrlFor(node.Path()); var link = new LinkTag(node.Path().Parts.Last(), url); tag.Add("span").AddClass("file").Append(link); })); }
public HtmlTag BuildLeafTag(ISpecNode node) { return new HtmlTag("li", tag => { var url = _urls.UrlFor(node.Path()); var link = new LinkTag(node.Path().Parts.Last(), url); tag.Add("span").AddClass("file").Append(link); }); }
public void find_specs_by_path() { ISpecNode findSpecs = theGraph.FindSpecNode(new SpecPath("Pak2/folder1/folder2")); findSpecs.ShouldNotBeNull(); findSpecs.AllSpecifications.Select(x => x.LibraryName).ShouldHaveTheSameElementsAs("spec6.js", "spec7.js", "spec8.js"); theGraph.FindSpecNode(new SpecPath("Pak2/folder1")).AllSpecifications.Select(x => x.LibraryName).ShouldHaveTheSameElementsAs("spec6.js", "spec7.js", "spec8.js", "spec4.js", "spec5.js"); theGraph.FindSpecNode(new SpecPath("Pak2")).AllSpecifications.Select(x => x.LibraryName).ShouldHaveTheSameElementsAs("spec6.js", "spec7.js", "spec8.js", "spec4.js", "spec5.js", "spec1.js", "spec2.js", "spec3.js"); }
private void writeNode(ISpecNode node) { var tag = _builder.BuildInPlaceHierarchyFor(node); _document.Add(tag); _document.Add("hr"); _requirements.WriteAssetsInto(_document, node.AllSpecifications); var fileSystem = new FileSystem(); node.AllSpecifications.SelectMany(x => x.HtmlFiles).Each(file => { var html = fileSystem.ReadStringFromFile(file.FullPath); _document.Add("div").Text(html).Encoded(false); }); }
public CompositeSpec(ISpecNode <T> specNode) { _specNode = specNode; var simplifiedSpecNode = new Lazy <ISpecNode <T> >(() => { var deMorganSpecNodeVisitor = new DeMorganSpecNodeVisitor <T>(); deMorganSpecNodeVisitor.Visit(specNode); return(deMorganSpecNodeVisitor.NewRoot); }); _isSatisfiedBy = new Lazy <Func <T, bool> >(() => { var isSatisfiedBySpecNodeVisitor = new IsSatisfiedBySpecNodeVisitor <T>(); isSatisfiedBySpecNodeVisitor.Visit(simplifiedSpecNode.Value); return(isSatisfiedBySpecNodeVisitor.IsSatisfiedBy); }); _isSatisfiedOn = new Lazy <string>(() => { var isSatisfiedOnSpecNodeVisitor = new IsSatisfiedOnSpecNodeVisitor <T>(); isSatisfiedOnSpecNodeVisitor.Visit(simplifiedSpecNode.Value); return(isSatisfiedOnSpecNodeVisitor.IsSatisfiedOn); }); }
public void AddChildren(ISpecNode node) { node.ImmediateChildren.Each(child => child.AcceptVisitor(this)); }
public OrSpecNode(ISpecNode <T> leftNode, ISpecNode <T> rightNode) => (LeftNode, RightNode) = (leftNode, rightNode);
public void Visit(ISpecNode <T> specNode) => specNode.Accept(this);
static string WrapOrBracket(ISpecNode <T> node, string isSatisfiedOn) => node is OrSpecNode <T>?$"({isSatisfiedOn})" : isSatisfiedOn;
public NotSpecNode(ISpecNode <T> nestedNode) => NestedNode = nestedNode;