aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/cover
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-08-22 17:48:57 +0200
committerTaras Madan <tarasmadan@google.com>2024-08-22 17:37:50 +0000
commit4d0fcc557324c5d7be71cf7deafa158a4e81ab1c (patch)
treeb950d0ab5bede28c9787b41065371656dfbf0e79 /pkg/cover
parent513a1f46284ff3005023eec178910da511cf133f (diff)
pkg/cover: fix layout
Html li item is not a block element by default. It allows sub-elements to overflow next line. This change still allow element to go next line, but the overall file tree layout will not be affected.
Diffstat (limited to 'pkg/cover')
-rw-r--r--pkg/cover/templates/cover.html43
1 files changed, 24 insertions, 19 deletions
diff --git a/pkg/cover/templates/cover.html b/pkg/cover/templates/cover.html
index 0c7f46419..d45a0f74b 100644
--- a/pkg/cover/templates/cover.html
+++ b/pkg/cover/templates/cover.html
@@ -46,7 +46,7 @@
}
.cover {
float: right;
- width: 250px;
+ width: 150px;
padding-right: 4px;
}
.cover-right {
@@ -105,7 +105,10 @@
.total-right {
float: right;
}
-
+ .flex-column {
+ display: flex;
+ flex-direction: column;
+ }
</style>
</head>
<body>
@@ -205,7 +208,7 @@
{{define "dir"}}
{{range $dir := .Dirs}}
- <li>
+ <li class="flex-column">
<span id="path/{{$dir.Path}}" class="caret hover">
{{$dir.Name}}
<span class="cover hover">
@@ -219,25 +222,27 @@
</li>
{{end}}
{{range $file := .Files}}
- <li><span class="hover">
- {{if $file.Covered}}
- <a href="#{{$file.Path}}" id="path/{{$file.Path}}" onclick="onFileClick({{$file.Index}})">
- {{$file.Name}}
- </a>
- <span class="cover hover">
- <a href="#{{$file.Path}}" id="path/{{$file.Path}}"
- onclick="{{if .HasFunctions}}onPercentClick{{else}}onFileClick{{end}}({{$file.Index}})">
- {{$file.Percent}}%
+ <li class="flex-column">
+ <span class="hover">
+ {{if $file.Covered}}
+ <a href="#{{$file.Path}}" id="path/{{$file.Path}}" onclick="onFileClick({{$file.Index}})">
+ {{$file.Name}}
</a>
- <span class="cover-right">of {{$file.Total}}</span>
- </span>
- {{else}}
- {{$file.Name}}
<span class="cover hover">
- ---
+ <a href="#{{$file.Path}}" id="path/{{$file.Path}}"
+ onclick="{{if .HasFunctions}}onPercentClick{{else}}onFileClick{{end}}({{$file.Index}})">
+ {{$file.Percent}}%
+ </a>
<span class="cover-right">of {{$file.Total}}</span>
</span>
- {{end}}
- </span></li>
+ {{else}}
+ {{$file.Name}}
+ <span class="cover hover">
+ ---
+ <span class="cover-right">of {{$file.Total}}</span>
+ </span>
+ {{end}}
+ </span>
+ </li>
{{end}}
{{end}}