Skip to content

Commit f7cd77c

Browse files
committed
tile filtering into main codebase
1 parent fb09ecc commit f7cd77c

8 files changed

Lines changed: 101 additions & 118 deletions

File tree

Samples/TestStack.BDDfy.Samples/UsingMetroStyleHTMLReportExample.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ public void RunInconclusiveStep()
4747
}
4848

4949

50+
[Test]
51+
public void RunPassing()
52+
{
53+
Configurator.BatchProcessors.HtmlReport.Disable();
54+
Configurator.BatchProcessors.HtmlMetroReport.Enable();
55+
56+
this.Given(_ => ILikeCucumbers())
57+
.When(_ => IEatSome())
58+
.Then(_ => ThenIShouldFeelGood())
59+
.BDDfy();
60+
}
61+
5062

5163
[Test]
5264
public void RunNotImplementedStep()
@@ -65,6 +77,10 @@ private void IDontLikeCucumbers()
6577
{
6678
}
6779

80+
private void ILikeCucumbers()
81+
{
82+
}
83+
6884
private void IEatSome()
6985
{
7086
}
@@ -75,6 +91,11 @@ private void ThenIShouldNotFeelGood()
7591
Assert.Inconclusive("Sample of what an inconclusive step looks like in a report");
7692
}
7793

94+
private void ThenIShouldFeelGood()
95+
{
96+
97+
}
98+
7899
private void ThenIShouldNotFeelGoodNotImpl()
79100
{
80101
throw new NotImplementedException("Example not implemented ex");

TestStack.BDDfy/Reporters/Html/HtmlTag.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public enum HtmlTag
1616
script,
1717
td,
1818
tr,
19-
table
19+
table,
20+
a
2021
}
2122
// ReSharper restore InconsistentNaming
2223
}

TestStack.BDDfy/Reporters/Html/MetroReportBuilder.cs

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ private void HtmlBody()
5656
using (OpenTag("<div id='main'>", HtmlTag.div))
5757
{
5858
Header();
59-
ResultSummary();
60-
ResultOptions();
59+
ResultSummary();
6160
ResultDetails();
6261
}
6362

@@ -94,63 +93,36 @@ private void ResultSummary()
9493
}
9594
}
9695

97-
using (OpenTag("<div class='tilerow'>", HtmlTag.div))
96+
using (OpenTag("<div class='tilerow' id='filterOptions'>", HtmlTag.div))
9897
{
99-
using (OpenTag("<div class='tile tileNoHover one limebg'>", HtmlTag.div))
100-
{
101-
AddLine("<h4>PASSED</h4>");
102-
AddLine(string.Format("<h1>{0}</h1>", _model.Summary.Passed));
103-
}
104-
using (OpenTag("<div class='tile tileNoHover one redbg'>", HtmlTag.div))
105-
{
106-
AddLine("<h4>FAILED</h4>");
107-
AddLine(string.Format("<h1>{0}</h1>", _model.Summary.Failed));
108-
}
109-
using (OpenTag("<div class='tile tileNoHover one orangebg'>", HtmlTag.div))
110-
{
111-
AddLine("<h4>INCONCLUSIVE</h4>");
112-
AddLine(string.Format("<h1>{0}</h1>", _model.Summary.Inconclusive));
113-
}
114-
using (OpenTag("<div class='tile tileNoHover one bluebg'>", HtmlTag.div))
98+
99+
var tileOptions = new[]
100+
{
101+
Tuple.Create("Passed", "limebg", _model.Summary.Passed),
102+
Tuple.Create("Failed", "redbg", _model.Summary.Failed),
103+
Tuple.Create("Inconclusive", "orangebg", _model.Summary.Inconclusive),
104+
Tuple.Create("NotImplemented", "bluebg", _model.Summary.NotImplemented)
105+
};
106+
107+
108+
foreach (var tileOption in tileOptions)
115109
{
116-
AddLine("<h4>NOT IMPLEMENTED</h4>");
117-
AddLine(string.Format("<h1>{0}</h1>", _model.Summary.NotImplemented));
110+
using (OpenTag("<a href='#'>", HtmlTag.a))
111+
{
112+
using (
113+
OpenTag(string.Format("<div class='tile one {0}' data-target-class='{1}'>", tileOption.Item2, tileOption.Item1), HtmlTag.div))
114+
{
115+
AddLine(string.Format("<h4>{0}</h4>", tileOption.Item1.ToUpperInvariant()));
116+
AddLine(string.Format("<h1>{0}</h1>", tileOption.Item3));
117+
}
118+
}
118119
}
119120
}
120121
}
121122
}
122123
}
123124

124-
private void ResultOptions()
125-
{
126-
using (OpenTag("<section id='resultOptions' class='group'>", HtmlTag.section))
127-
{
128-
AddLine("<h3>options</h3>");
129-
using (OpenTag("<ul id='filterOptions'>", HtmlTag.ul))
130-
{
131-
using (OpenTag("<li class='Passed'>", HtmlTag.li))
132-
{
133-
AddLine("<input id='passedFilter' type='checkbox' checked='' data-target-class='Passed'>");
134-
AddLine("<label for='passedFilter'>passed</label>");
135-
}
136-
using (OpenTag("<li class='Failed'>", HtmlTag.li))
137-
{
138-
AddLine("<input id='failedFilter' type='checkbox' checked='' data-target-class='Failed'>");
139-
AddLine("<label for='failedFilter'>failed</label>");
140-
}
141-
using (OpenTag("<li class='Inconclusive'>", HtmlTag.li))
142-
{
143-
AddLine("<input id='inconclusiveFilter' type='checkbox' checked='' data-target-class='Inconclusive'>");
144-
AddLine("<label for='inconclusiveFilter'>inconclusive</label>");
145-
}
146-
using (OpenTag("<li class='NotImplemented'>", HtmlTag.li))
147-
{
148-
AddLine("<input id='notImplementedFilter' type='checkbox' checked='' data-target-class='NotImplemented'>");
149-
AddLine("<label for='notImplemented'>not implemented</label>");
150-
}
151-
}
152-
}
153-
}
125+
154126

155127
private void ExpandCollapse()
156128
{
@@ -189,7 +161,7 @@ private void Footer()
189161
else
190162
EmbedJavascriptFile(HtmlReportResources.jquery_2_1_0_min);
191163

192-
EmbedJavascriptFile(HtmlReportResources.classic_js_min);
164+
EmbedJavascriptFile(HtmlReportResources.metro_js_min);
193165
EmbedJavascriptFile(_model.CustomJavascript, HtmlReportResources.CustomJavascriptComment);
194166
}
195167

0 commit comments

Comments
 (0)