Skip to content

Commit 2966037

Browse files
authored
frontend: Explain zero coverage heuristics, fixes #97 (#454)
1 parent 520f435 commit 2966037

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

frontend/src/base.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ <h2>
135135
{{#filters}}
136136
<input type="checkbox" name="{{ key }}" id="{{ key }}" {{#checked}}checked="checked"{{/checked}}>
137137
<label for="{{ key }}">{{ message }}</label>
138+
{{#needs_explanation}}
139+
<div class="tooltip">
140+
<span class="questionbox">?</span>
141+
<span class="tooltiptext">For <strong>JavaScript</strong>, files with at least one function where all functions are uncovered.
142+
<br />For <strong>C/C++/other languages</strong>, files which have no covered lines.</span>
143+
</div>
144+
{{/needs_explanation}}
138145
{{/filters}}
139146

140147
<select name="last_push" id="last_push">

frontend/src/style.scss

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,3 +394,56 @@ $samp_size: 20px;
394394
float: right;
395395
}
396396
}
397+
398+
// Tooltip container for explanation (issue #97 enhancement)
399+
#menu .tooltip {
400+
position: relative;
401+
display: inline-block;
402+
403+
// Question mark container
404+
.questionbox {
405+
text-align: center;
406+
border-bottom: 1px dotted black;
407+
cursor: default;
408+
}
409+
410+
// Show the tooltip text when you mouse over the tooltip container
411+
&:hover .tooltiptext {
412+
visibility: visible;
413+
opacity: 1;
414+
}
415+
416+
.tooltiptext {
417+
visibility: hidden;
418+
line-height: 120%;
419+
background-color: $default_color;
420+
color: white;
421+
text-align: left;
422+
padding: 1vh 1vw;
423+
border-radius: 6px;
424+
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
425+
426+
// Position the tooltip
427+
position: absolute;
428+
z-index: 1;
429+
width: 30vw;
430+
top: 100%;
431+
left: 50%;
432+
margin-left: -16vw; // Use half of the width including left horizontal padding size i.e 30vw/2 + 1vw
433+
434+
&::after {
435+
content: " ";
436+
position: absolute;
437+
bottom: 100%; /* At the top of the tooltip */
438+
left: 50%;
439+
margin-left: -5px;
440+
border-width: 5px;
441+
border-style: solid;
442+
border-color: transparent transparent $default_color transparent;
443+
}
444+
445+
// Transition animation
446+
opacity: 0;
447+
transition: opacity 1s;
448+
}
449+
}

frontend/src/zero_coverage_report.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ export function zeroCoverageMenu(route) {
5555
return {
5656
key,
5757
message: filter.name,
58-
checked: isEnabled(key)
58+
checked: isEnabled(key),
59+
needs_explanation: key === "completely_uncovered"
5960
};
6061
}),
6162
last_pushes: Object.entries(ZERO_COVERAGE_PUSHES).map(

0 commit comments

Comments
 (0)