Use lists and fix some issues

This commit is contained in:
Michael Miller 2021-08-18 18:18:18 -06:00
parent dd0ef01369
commit 18b42304c9
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436

View file

@ -1,43 +1,43 @@
<div id="summary" class="<%= summary_result(report) %>"> <div id="summary" class="<%= summary_result(report) %>">
<h1>Test Results</h1> <h1>Test Results</h1>
<span class="result <%= summary_result(report) %>"><% escape(Components::Totals.new(report.counts)) %></span> <span class="totals <%= summary_result(report) %>"><% escape(totals(report)) %></span>
<span class="elapsed" title="<% escape(report.runtime) %>"><% escape(runtime(report.runtime)) %></span> <span class="elapsed" title="<% escape(report.runtime) %>"><% escape(runtime(report.runtime)) %></span>
</div> </div>
<%- if report.counts.fail > 0 -%> <%- if report.counts.fail > 0 -%>
<div id="failure-list">
<h2>Failures</h2> <h2>Failures</h2>
<ul id="failure-list">
<%- report.failures.each do |example| -%> <%- report.failures.each do |example| -%>
<div class="example fail"> <li class="example fail">
<a href="#example-<%= example.object_id %>" title="Jump to result"> <a href="#example-<%= example.object_id %>" title="Jump to result">
<h3 class="full-name"><% escape(example) %></h3> <h3 class="full-name"><% escape(example) %></h3>
</a> </a>
</div> </li>
<%- end -%> <%- end -%>
</div> </ul>
<%- end -%> <%- end -%>
<%- if report.counts.pending > 0 -%> <%- if report.counts.pending > 0 -%>
<div id="pending-list">
<h2>Pending</h2> <h2>Pending</h2>
<ul id="pending-list">
<%- report.pending.each do |example| -%> <%- report.pending.each do |example| -%>
<div class="example pending"> <li class="example pending">
<a href="#example-<%= example.object_id %>" title="Jump to result"> <a href="#example-<%= example.object_id %>" title="Jump to result">
<h3 class="full-name"><% escape(example) %></h3> <h3 class="full-name"><% escape(example) %></h3>
</a> </a>
</div> </li>
<%- end -%> <%- end -%>
</div> </ul>
<%- end -%> <%- end -%>
<div id="example-list">
<h2>Examples</h2> <h2>Examples</h2>
<ul id="example-list">
<%- report.examples.each do |example| -%> <%- report.examples.each do |example| -%>
<div class="example <%= example.result %>"> <li class="example <%= example.result %>">
<h3 id="#example-<%= example.object_id %>" class="full-name"><% escape(example) %></h3> <h3 id="#example-<%= example.object_id %>" class="full-name"><% escape(example) %></h3>
<span class="result <%= example.result %>"><%= example.result %></span> <span class="result <%= example.result %>"><%= example.result %></span>
<span class="elapsed" title="<% escape(example.result.elapsed) %>"><% escape(runtime(example.result.elapsed)) %></span> <span class="elapsed" title="<% escape(example.result.elapsed) %>"><% escape(runtime(example.result.elapsed)) %></span>
<% if result = example.result.as?(PendingResult) %><span class="message"><% escape(result.reason) -%></span> <% if result = example.result.as?(PendingResult) %><span class="message"><% escape(result.reason) %></span>
<%- elsif result = example.result.as?(ErrorResult) -%> <%- elsif result = example.result.as?(ErrorResult) -%>
<span class="error"> <span class="error">
@ -59,10 +59,11 @@
<%- if example.result.expectations.empty? -%> <%- if example.result.expectations.empty? -%>
<span class="muted">No expectations reported</span> <span class="muted">No expectations reported</span>
<%- else -%> <%- else -%>
<div class="expectation-list"> <h4>Expectations</h4>
<ol class="expectation-list">
<%- example.result.expectations.each do |expectation| -%> <%- example.result.expectations.each do |expectation| -%>
<div class="expectation <%= expectation.satisfied? ? "pass" : "fail" %>"> <li class="expectation <%= expectation.satisfied? ? "pass" : "fail" %>">
<h4><% escape(expectation.description) %></h4> <h5><% escape(expectation.description) %></h5>
<%- if expectation.satisfied? -%> <%- if expectation.satisfied? -%>
<span class="result">pass</span> <span class="result">pass</span>
<%- else -%> <%- else -%>
@ -76,10 +77,10 @@
</dl> </dl>
<%- end -%> <%- end -%>
<% if location = expectation.location? %><span class="location"><% escape(location) %></span><% end %> <% if location = expectation.location? %><span class="location"><% escape(location) %></span><% end %>
</div> </li>
<%- end -%> <%- end -%>
</div> </ol>
<%- end -%> <%- end -%>
</div> </li>
<%- end -%> <%- end -%>
</div> </ul>