From 617cbdb083e26e6052a8b90fee23ae4c23abb06c Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 4 Oct 2021 14:50:52 -0500 Subject: [PATCH] add message to HTML report showing filtering option --- CHANGELOG.md | 5 +++++ lib/templates/html/htmlcov/_style.html.eex | 7 +++++++ lib/templates/html/htmlcov/coverage.html.eex | 8 ++++++-- test/chaps/html_test.exs | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70195385..a11f002b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## 0.15.2 - 2021-10-04 +### Added + +- Added message to HTML report when the `:html_filter_fully_covered` option + is enabled + ### Fixed - Fixed HTML filtering functionality diff --git a/lib/templates/html/htmlcov/_style.html.eex b/lib/templates/html/htmlcov/_style.html.eex index 23752f1e..f04c3626 100644 --- a/lib/templates/html/htmlcov/_style.html.eex +++ b/lib/templates/html/htmlcov/_style.html.eex @@ -315,4 +315,11 @@ code .init { color: #2F6FAD } code .string { color: #5890AD } code .keyword { color: #8A6343 } code .number { color: #2F6FAD } + +span.mono { + font: 12px monaco, monospace; + background: #efefef; + border-radius: 0.25rem; + padding: 0.25rem 0.5rem 0.25rem 0.5rem; +} diff --git a/lib/templates/html/htmlcov/coverage.html.eex b/lib/templates/html/htmlcov/coverage.html.eex index f44c3934..0b62bafb 100644 --- a/lib/templates/html/htmlcov/coverage.html.eex +++ b/lib/templates/html/htmlcov/coverage.html.eex @@ -1,3 +1,4 @@ +<% files = Enum.reject(@cov.files, fn file -> @filter_fully_covered and file.coverage == 100 end) %> @@ -11,7 +12,7 @@

Coverage

+ <%= if @filter_fully_covered do %> +

The :html_filter_fully_covered coverage option is turned on. Modules with full coverage are being hidden.

+ <% end %>
- <%= for file <- @cov.files do %> + <%= for file <- files do %> <%= unless @filter_fully_covered and file.coverage == 100 do %>

<%= file.filename %>

diff --git a/test/chaps/html_test.exs b/test/chaps/html_test.exs index 63fa3b06..69448378 100644 --- a/test/chaps/html_test.exs +++ b/test/chaps/html_test.exs @@ -5,7 +5,7 @@ defmodule Chaps.HtmlTest do alias Chaps.Html @file_name "chaps.html" - @file_size 20375 + @file_size 20521 @test_output_dir "cover_test/" @test_template_path "lib/templates/html/htmlcov/"