Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to Bootstrap 5 and adds theme support for code coverage. #1036

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Report/Html/Facade.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ private function copyFiles(string $target): void
copy($this->templatePath . 'icons/file-directory.svg', $dir . 'file-directory.svg');

$dir = $this->directory($target . '_js');
copy($this->templatePath . 'js/bootstrap.min.js', $dir . 'bootstrap.min.js');
copy($this->templatePath . 'js/popper.min.js', $dir . 'popper.min.js');
copy($this->templatePath . 'js/bootstrap.bundle.min.js', $dir . 'bootstrap.bundle.min.js');
copy($this->templatePath . 'js/d3.min.js', $dir . 'd3.min.js');
copy($this->templatePath . 'js/jquery.min.js', $dir . 'jquery.min.js');
copy($this->templatePath . 'js/nv.d3.min.js', $dir . 'nv.d3.min.js');
Expand Down
10 changes: 5 additions & 5 deletions src/Report/Html/Renderer/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ private function renderSourceWithLineCoverage(FileNode $node): string

if (!empty($popoverTitle)) {
$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
' data-bs-title="%s" data-bs-content="%s" data-bs-placement="top" data-bs-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
Expand Down Expand Up @@ -635,7 +635,7 @@ private function renderSourceWithBranchCoverage(FileNode $node): string
$trClass = $lineCss . ' popin';

$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
' data-bs-title="%s" data-bs-content="%s" data-bs-placement="top" data-bs-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
Expand Down Expand Up @@ -725,7 +725,7 @@ private function renderSourceWithPathCoverage(FileNode $node): string
$trClass = $lineCss . ' popin';

$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
' data-bs-title="%s" data-bs-content="%s" data-bs-placement="top" data-bs-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
Expand Down Expand Up @@ -823,7 +823,7 @@ private function renderBranchLines(array $branch, array $codeLines, array $testD

if (!empty($popoverTitle)) {
$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
' data-bs-title="%s" data-bs-content="%s" data-bs-placement="top" data-bs-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
Expand Down Expand Up @@ -938,7 +938,7 @@ private function renderPathLines(array $path, array $branches, array $codeLines,

if (!empty($popoverTitle)) {
$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
' data-bs-title="%s" data-bs-content="%s" data-bs-placement="top" data-bs-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
Expand Down
9 changes: 4 additions & 5 deletions src/Report/Html/Renderer/Template/css/bootstrap.min.css

Large diffs are not rendered by default.

94 changes: 63 additions & 31 deletions src/Report/Html/Renderer/Template/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,40 @@ body {
border: 0 !important;
}

.table tbody tr.covered-by-large-tests, li.covered-by-large-tests, tr.success, td.success, li.success, span.success {
background-color: {{success-low}};
.table tbody tr.covered-by-large-tests td, li.covered-by-large-tests, tr.success, td.success, li.success, span.success {
/* background-color: {{success-low}}; */
/* background-color: var(--bs-success-border-subtle); */
background-color: rgb(from var(--bs-success) r g b / 0.25);
}

.table tbody tr.covered-by-medium-tests, li.covered-by-medium-tests {
background-color: {{success-medium}};
.table tbody tr.covered-by-medium-tests td, li.covered-by-medium-tests {
/* background-color: {{success-medium}}; */
/* background-color: var(--bs-success-bg-subtle); */
background-color: rgb(from var(--bs-success) r g b / 0.5);
}

.table tbody tr.covered-by-small-tests, li.covered-by-small-tests {
background-color: {{success-high}};
.table tbody tr.covered-by-small-tests td, li.covered-by-small-tests {
/* background-color: {{success-high}}; */
/* background-color: var(--bs-success-bg-subtle); */
background-color: rgb(from var(--bs-success) r g b / 0.75);
}

.table tbody tr.warning, .table tbody td.warning, li.warning, span.warning {
background-color: {{warning}};
.table tbody tr.warning td, .table tbody td.warning, li.warning, span.warning {
/* background-color: {{warning}}; */
/* background-color: var(--bs-warning-bg-subtle); */
background-color: rgb(from var(--bs-warning) r g b / 0.25);
}

.table tbody tr.danger, .table tbody td.danger, li.danger, span.danger {
background-color: {{danger}};
.table tbody tr.danger td, .table tbody td.danger, li.danger, span.danger {
/* background-color: {{danger}}; */
/* background-color: var(--bs-danger-bg-subtle); */
background-color: rgb(from var(--bs-danger) r g b / 0.25);
}

.table tbody td.info {
background-color: #d9edf7;
/* background-color: #d9edf7; */
/* background-color: var(--bs-info-bg-subtle); */
background-color: rgb(from var(--bs-info) r g b / 0.25);
}

td.big {
Expand All @@ -72,29 +84,35 @@ td.small {
}

td.codeLine {
font-family: "Source Code Pro", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
/* font-family: "Source Code Pro", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; */
font-family: "Source Code Pro", var(--bs-font-monospace);
white-space: pre-wrap;
}

td span.comment {
color: #888a85;
/* color: #888a85; */
color: var(--bs-secondary-color);
}

td span.default {
color: #2e3436;
/* color: #2e3436; */
color: var(--bs-body-color);
}

td span.html {
color: #888a85;
/* color: #888a85; */
color: var(--bs-secondary-color);
}

td span.keyword {
color: #2e3436;
/* color: #2e3436; */
color: var(--bs-body-color);
font-weight: bold;
}

pre span.string {
color: #2e3436;
/* color: #2e3436; */
color: var(--bs-body-color);
}

span.success, span.warning, span.danger {
Expand All @@ -112,10 +130,13 @@ span.success, span.warning, span.danger {
}

svg text {
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
/* font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; */
font-family: var(--bs-font-sans-serif);
font-size: 11px;
color: #666;
fill: #666;
/* color: #666; */
color: var(--bs-gray);
/* fill: #666; */
fill: var(--bs-gray);
}

.scrollbox {
Expand All @@ -125,7 +146,8 @@ svg text {
}

table + .structure-heading {
border-top: 1px solid lightgrey;
/* border-top: 1px solid lightgrey; */
border-top: 1px solid var(--bs-gray-200);
padding-top: 0.5em;
}

Expand All @@ -137,22 +159,32 @@ table + .structure-heading {
text-align: center;
}

.covered-by-small-tests {
background-color: {{success-high}};
.covered-by-small-tests, tr.covered-by-small-tests td {
/* background-color: {{success-high}}; */
/* background-color: var(--bs-success-bg-subtle); */
background-color: rgb(from var(--bs-success) r g b / 0.75);
}

.covered-by-medium-tests {
background-color: {{success-medium}};
.covered-by-medium-tests, tr.covered-by-medium-tests td {
/* background-color: {{success-medium}}; */
/* background-color: var(--bs-success-bg-subtle); */
background-color: rgb(from var(--bs-success) r g b / 0.5);
}

.covered-by-large-tests {
background-color: {{success-low}};
.covered-by-large-tests, tr.covered-by-large-tests td {
/* background-color: {{success-low}}; */
/* background-color: var(--bs-success-border-subtle); */
background-color: rgb(from var(--bs-success) r g b / 0.25);
}

.not-covered {
background-color: {{danger}};
.not-covered, tr.not-covered td {
/* background-color: {{danger}}; */
/* background-color: var(--bs-danger-bg-subtle); */
background-color: rgb(from var(--bs-danger) r g b / 0.25);
}

.not-coverable {
background-color: {{warning}};
.not-coverable, tr.not-coverable td {
/* background-color: {{warning}}; */
/* background-color: var(--bs-warning-bg-subtle); */
background-color: rgb(from var(--bs-warning) r g b / 0.25);
}
2 changes: 1 addition & 1 deletion src/Report/Html/Renderer/Template/dashboard.html.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<title>Dashboard for {{full_path}}</title>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<title>Dashboard for {{full_path}}</title>
Expand Down
2 changes: 1 addition & 1 deletion src/Report/Html/Renderer/Template/directory.html.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<title>Code Coverage for {{full_path}}</title>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<title>Code Coverage for {{full_path}}</title>
Expand Down
5 changes: 2 additions & 3 deletions src/Report/Html/Renderer/Template/file.html.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<title>Code Coverage for {{full_path}}</title>
Expand Down Expand Up @@ -58,8 +58,7 @@
</footer>
</div>
<script src="{{path_to_root}}_js/jquery.min.js?v={{version}}" type="text/javascript"></script>
<script src="{{path_to_root}}_js/popper.min.js?v={{version}}" type="text/javascript"></script>
<script src="{{path_to_root}}_js/bootstrap.min.js?v={{version}}" type="text/javascript"></script>
<script src="{{path_to_root}}_js/bootstrap.bundle.min.js?v={{version}}" type="text/javascript"></script>
<script src="{{path_to_root}}_js/file.js?v={{version}}" type="text/javascript"></script>
</body>
</html>
5 changes: 2 additions & 3 deletions src/Report/Html/Renderer/Template/file_branch.html.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<title>Code Coverage for {{full_path}}</title>
Expand Down Expand Up @@ -60,8 +60,7 @@
</footer>
</div>
<script src="{{path_to_root}}_js/jquery.min.js?v={{version}}" type="text/javascript"></script>
<script src="{{path_to_root}}_js/popper.min.js?v={{version}}" type="text/javascript"></script>
<script src="{{path_to_root}}_js/bootstrap.min.js?v={{version}}" type="text/javascript"></script>
<script src="{{path_to_root}}_js/bootstrap.bundle.min.js?v={{version}}" type="text/javascript"></script>
<script src="{{path_to_root}}_js/file.js?v={{version}}" type="text/javascript"></script>
</body>
</html>
7 changes: 0 additions & 7 deletions src/Report/Html/Renderer/Template/js/bootstrap.min.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/Report/Html/Renderer/Template/js/jquery.min.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/Report/Html/Renderer/Template/js/popper.min.js

This file was deleted.

Loading