Skip to content

Commit 6869b06

Browse files
committed
feat(coverage): remove coverage badge hack.
1 parent a665c5d commit 6869b06

File tree

8 files changed

+1
-90
lines changed

8 files changed

+1
-90
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
<span class="esdoc-coverage"></span>
21
# My Project
32
this is My Project README
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
<span class="esdoc-coverage"></span>
21
# My Project
32
this is My Project README
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
<span class="esdoc-coverage"></span>
21
# My Project
32
this is My Project README
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
<span class="esdoc-coverage"></span>
21
# My Project
32
this is My Project README

src/Publisher/Builder/DocBuilder.js

-25
Original file line numberDiff line numberDiff line change
@@ -1008,31 +1008,6 @@ export default class DocBuilder {
10081008
}
10091009
}
10101010

1011-
/**
1012-
* build coverage html.
1013-
* @param {CoverageObject} coverageObj - target coverage object.
1014-
* @returns {string} html of coverage badge.
1015-
* @private
1016-
* @deprecated
1017-
*/
1018-
_buildCoverageHTML(coverageObj) {
1019-
let coverage = Math.floor(100 * coverageObj.actualCount / coverageObj.expectCount);
1020-
let colorClass;
1021-
if (coverage < 50) {
1022-
colorClass = 'esdoc-coverage-low';
1023-
} else if (coverage < 90) {
1024-
colorClass = 'esdoc-coverage-middle';
1025-
} else {
1026-
colorClass = 'esdoc-coverage-high';
1027-
}
1028-
1029-
let html = `<a href="https://esdoc.org" class="esdoc-coverage-wrap">
1030-
<span class="esdoc-coverage-label">document</span><span class="esdoc-coverage-ratio ${colorClass}">${coverage}%</span>
1031-
</a>`;
1032-
1033-
return html;
1034-
}
1035-
10361011
//_buildAuthorHTML(doc, separator = '\n') {
10371012
// if (!doc.author) return '';
10381013
//

src/Publisher/Builder/IndexDocBuilder.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,6 @@ export default class IndexDocBuilder extends DocBuilder {
5656
ice.load('index', indexContent);
5757
}
5858

59-
let result = ice.html;
60-
61-
// fixme: deprecated
62-
if (this._config.coverage) {
63-
let $ = cheerio.load(result);
64-
if ($('.esdoc-coverage').length) {
65-
console.log('[deprecated] coverage badge is deprecated. use badge of ESDoc Hosting Service(https://doc.esdoc.org)');
66-
}
67-
}
68-
69-
return result;
59+
return ice.html;
7060
}
7161
}

src/Publisher/Builder/template/css/style.css

-49
Original file line numberDiff line numberDiff line change
@@ -740,55 +740,6 @@ table.test-summary .test-target > span:first-child {
740740
display: inline-block;
741741
}
742742

743-
/* coverage badge */
744-
.esdoc-coverage {
745-
display: inline-block;
746-
height: 20px;
747-
vertical-align: top;
748-
}
749-
750-
h1 .esdoc-coverage {
751-
position: relative;
752-
top: -4px;
753-
}
754-
755-
.esdoc-coverage-wrap {
756-
color: white;
757-
font-size: 12px;
758-
font-weight: 500;
759-
}
760-
761-
.esdoc-coverage-label {
762-
padding: 3px 4px 3px 6px;
763-
background: linear-gradient(to bottom, #5e5e5e 0%,#4c4c4c 100%);
764-
border-radius: 4px 0 0 4px;
765-
display: inline-block;
766-
height: 20px;
767-
box-sizing: border-box;
768-
line-height: 14px;
769-
}
770-
771-
.esdoc-coverage-ratio {
772-
padding: 3px 6px 3px 4px;
773-
border-radius: 0 4px 4px 0;
774-
display: inline-block;
775-
height: 20px;
776-
box-sizing: border-box;
777-
line-height: 14px;
778-
}
779-
780-
.esdoc-coverage-low {
781-
background: linear-gradient(to bottom, #db654f 0%,#c9533d 100%);
782-
}
783-
784-
.esdoc-coverage-middle {
785-
background: linear-gradient(to bottom, #dab226 0%,#c9a179 100%);
786-
}
787-
788-
.esdoc-coverage-high {
789-
background: linear-gradient(to bottom, #4fc921 0%,#3eb810 100%);
790-
}
791-
792743
.github-markdown .manual-toc {
793744
padding-left: 0;
794745
}

test/fixture/package/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![Build Status](https://travis-ci.org/esdoc/esdoc.svg?branch=master)](https://travis-ci.org/esdoc/esdoc)
22
[![Coverage Status](https://coveralls.io/repos/esdoc/esdoc/badge.svg)](https://coveralls.io/r/esdoc/esdoc)
3-
<span class="esdoc-coverage"></span>
43

54
# ESDoc Test Fixture
65
this is ESDoc Test Fixture README.

0 commit comments

Comments
 (0)